| Package | nape.phys |
| Class | Material |
Physics Material giving shapes density,elasticity and frictional values.
Public Properties
| Property | Defined By | |
|
elasticity : Float How elastic the material is |
Material | |
|
staticFriction : Float Coeffecient of static friction for the material |
Material | |
|
dynamicFriction : Float Coeffecient of dynamic/kinetic friction for the material |
Material | |
|
rollingFriction : Float Coeffecient of rolling friction for the material |
Material | |
|
density : Float Density of material |
Material | |
|
shapes : ShapeList [read-only] Immutable list of active shapes using material |
Material |
Constructor
| Constructor | ||
|
new(?elasticity:Float=0, ?dynamicFirction:Float=1, ?staticFricion:Float=2, ?density:Float=1, ?rollingFriction:Float=0.01) Construct new Material |
Public Methods
| Method | Defined By | |
|
const
copy() : Material Produce a copy of the material |
Material |
Public Static Methods
| Method | Defined By | |
|
static
wood() : Material Wooden material |
Material | |
|
static
steel() : Material Steel material |
Material | |
|
static
ice() : Material Ice material |
Material | |
|
static
rubber() : Material Rubber material |
Material | |
|
static
glass() : Material Glass material |
Material | |
|
static
sand() : Material Sand material |
Material |
Property Detail
| elasticity | property |
property elasticity : FloatThe higher the elasticity, the more elastic the material is.
0 elasticity corresponds to total inelasticity, 1 corresponds to complete elasticity.
Note that values higher than 1 are perfectly acceptable but will not make the material any more elastic, however doing this can be useful to influence the resultant pair-wise elasticity coefecient calculated when shape/particles interact which is a combination of the two elastic coeffecients. For example setting elasticity to Math.POSITIVE_INFINITY will mean that whenever this shape collides with something, it will ALWAYS be completely elastic (unless the other material has -inf as elasticity)
Equally, values lower than 0 are also acceptable, and will serve to decrease the combined elasticity of interacting shapes, with Math.NEGATIVE_INFINITY acting to never allow elastic behaviour.
| staticFriction | property |
|
property staticFriction : FloatThe higher the coef. of static friction, the harder it is to cause the shape to slide from a standstill
0 corresponds to no static frition, and any finite positive value is allowed.
Error on setter if:
staticFriction < 0
| dynamicFriction | property |
|
property dynamicFriction : FloatThe higher the coef. of dynamic friction, the quicker a sliding shape will come to a standstill
0 corresponds to no dynamic frition, and any finite positive value is allowed.
Error on setter if:
dynamicFriction < 0
| rollingFriction | property |
|
property rollingFriction : FloatThe higher this coef. the quicker a rolling circle will come to rest, although rolling friction only occurs when one shape is a circle, it is still of use to set this coeffecient on polygons for example, the predefined sand material has a very high rolling friction so that when used on say the ground, a rolling circle will quickly come to rest even though the gruond itself is not a circle.
| density | property |
|
property density : FloatThe density of a material (measured in g/px^2) corresponds to how much mass a shape will have per unit area.
Density must be strictly positive
Error on setter if:
density <= 0
| shapes | property |
|
readonly property shapes : ShapeListReference to an immutable list of active shapes that make use of this material. Active shapes refers to those currently inside of a Space object.
Constructor Detail
function new(?elasticity:Float=0, ?dynamicFirction:Float=1, ?staticFricion:Float=2, ?density:Float=1, ?rollingFriction:Float=0.01)Construct new Material
Method Detail
Static Method Detail
| wood | static | method |
static function wood() : MaterialReturns a new Material intended to model properties of wood
| steel | static | method |
|
static function steel() : MaterialReturns a new Material intended to model properties of steel
| ice | static | method |
|
static function ice() : MaterialReturns a new Material intended to model properties of ice
| rubber | static | method |
|
static function rubber() : MaterialReturns a new Material intended to model properties of rubber
| glass | static | method |
|
static function glass() : MaterialReturns a new Material intended to model properties of glass
| sand | static | method |
|
static function sand() : MaterialReturns a new Material intended to model properties of sand
