Material

nape.phys.Material (final class)

Material property providing physical attributes to a Shape.

Static Members

nape
wood(): Material

Predefined constructor for a wood style Material.

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

nape
steel(): Material

Predefined constructor for a steel style Material.

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

nape
ice(): Material

Predefined constructor for a ice style Material.

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

nape
rubber(): Material

Predefined constructor for a rubber style Material.

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

nape
glass(): Material

Predefined constructor for a glass style Material.

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

nape
sand(): Material

Predefined constructor for a sand style Material.

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

Instance Members

@private


nape
userData: 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.

@default {}


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.


nape
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.

@default 0.0


nape
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.

@default 1


nape
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.

@default 2


nape
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.

@default 1


nape
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.

@default 0.01


nape
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 Description
Material The copied Material.

nape
toString(): String

@private

Returns
String

nape
new(?elasticity: Float = 0.0, ?dynamicFriction: Float = 1.0, ?staticFriction: Float = 2.0, ?density: Float = 1, ?rollingFriction: Float = 0.001): Void

Construct a new Material object.

Name Type Default Description
elasticity Float 0.0 The coeffecient of elasticity for material. (default 0.0)
dynamicFriction Float 1.0 The coeffecient of dynamic friction for material. (default 1.0)
staticFriction Float 2.0 The coeffecient of static friction for material. (default 2.0)
density Float 1 The density of the shape using this material in units of g/pixel/pixel. (default 1.0)
rollingFriction Float 0.001 The coeffecient of rolling friction for material used in circle friction computations. (default 0.001)

Private Members

Metadata

Name Parameters
:final -