Material property providing physical attributes to a Shape.

Static methods

staticglass():Material

Predefined constructor for a glass style Material.

Returns:

new Material(0.4,0.4,0.94,2.6,0.002)

staticice():Material

Predefined constructor for a ice style Material.

Returns:

new Material(0.3,0.03,0.1,0.9,0.0001)

staticrubber():Material

Predefined constructor for a rubber style Material.

Returns:

new Material(0.8,1.0,1.4,1.5,0.01)

staticsand():Material

Predefined constructor for a sand style Material.

Returns:

new Material(-1.0,0.45,0.6,1.6,16.0)

staticsteel():Material

Predefined constructor for a steel style Material.

Returns:

new Material(0.2,0.57,0.74,7.8,0.001)

staticwood():Material

Predefined constructor for a wood style Material.

Returns:

new Material(0.4,0.2,0.38,0.7,0.005)

Constructor

@:value({ rollingFriction : 0.001, density : 1, staticFriction : 2.0, dynamicFriction : 1.0, elasticity : 0.0 })new(elasticity:Float = 0.0, dynamicFriction:Float = 1.0, staticFriction:Float = 2.0, density:Float = 1, rollingFriction:Float = 0.001)

Construct a new Material object.

Parameters:

elasticity

The coeffecient of elasticity for material. (default 0.0)

dynamicFriction

The coeffecient of dynamic friction for material. (default 1.0)

staticFriction

The coeffecient of static friction for material. (default 2.0)

density

The density of the shape using this material in units of g/pixel/pixel. (default 1.0)

rollingFriction

The coeffecient of rolling friction for material used in circle friction computations. (default 0.001)

Returns:

The constructed Material object.

Variables

density:Float

Density of Shape's using this Material.

This property has units of g/pixel/pixel, not Kg/pixel/pixel for the simple reason that we get more reasonable values like 1 instead of 0.001 to attain reasonable mass values for Bodys.

dynamicFriction:Float

Coeffecient of dynamic friction for material.

This property may take any zero or positive value. Coeffecients of dynamicFriction are combined by taking the square root of their product.

The higher this value the more quickly objects will slow down from speed when sliding.

elasticity:Float

Elasticity of material.

This property may take any value. Coeffecients of elasticity are combined by taking their average, and then clamping to the range [0,1]. In this way you may give very large values (even infinites) to this property to bias the result of combining elasticities.

A combined, clamped value of 0 results in no bouncing whatsoever.
A combine, clamped value of 1 results in complete elasticity where if possible, the objects will not lose any energy at all.

rollingFriction:Float

Coeffecient of rolling friction for circle interactions.

This property may take any zero or positive value. Coeffecients of staticFriction are combined by taking the square root of their product.

The higher this value, the more quickly a rolling circle - which would otherwise roll forever ignoring drag and numerical issues - will come to rest.

read onlyshapes:ShapeList

Set of all active shapes using this object.

Activeness of a shape in the sense that the Shape's Body is inside of a Space.

This list is immutable.

staticFriction:Float

Coeffecient of static friction for material.

This property may take any zero or positive value. Coeffecients of staticFriction are combined by taking the square root of their product.

The higher this value the more quickly objects will come to rest once moving very slowly, and the harder it will be to cause the objcet to begin to slide.

read onlyuserData:Dynamic<Dynamic>

Dynamic object for user to store additional data.

This object cannot be set, only its dynamically created properties may be set. In AS3 the type of this property is &#42

This object will be lazily constructed so that until accessed for the first time, will be null internally.

@:value(null)zpp_inner:ZPP_Material = null

@private

Methods

copy():Material

Produce a copy of this Material object.

The copied object will be identical in all properties with the the copied userData being assigned the same fields as 'this' Shape with the same values copied over by reference for object types.

Returns:

The copied Material.

@:keeptoString():String

@private