class nape.phys.Material

Available on all platforms

Material property providing physical attributes to a Shape.

Class Fields

static function glass():Material

Predefined constructor for a glass style Material. * *

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

static function ice():Material

Predefined constructor for a ice style Material. * *

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

static function rubber():Material

Predefined constructor for a rubber style Material. * *

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

static function sand():Material

Predefined constructor for a sand style Material. * *

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

static function steel():Material

Predefined constructor for a steel style Material. * *

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

static function wood():Material

Predefined constructor for a wood style Material. * *

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

Instance Fields

var 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

var 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

var 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

var 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

var shapes: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.

var 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

var userData:DynamicDynamic

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 {}

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

Construct a new Material object. * *

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.

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

function toString():String

@private