Interface: PhysicsBodyOptions
Properties
allowsRotation?
optionalallowsRotation:boolean
Whether or not the body can rotate. Defaults to true.
Remarks
If true, this sets the Matter.js inertia property to Infinity.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:64
angularVelocity?
optionalangularVelocity:number
Body angular velocity.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:87
categoryBitMask?
optionalcategoryBitMask:number
A 32-bit mask specifying which categories this physics body belongs to.
Remarks
There are up to 32 different categories that physics bodies can
belong to. Each category is represented by a bit in the mask. For example,
if a body belongs to categories 1 and 3, its category bit mask is
0b00000000000000000000000000000101. Along with the collisionBitMask,
this property determines which other bodies this physics body can
collide with. Default category for all physics bodies is 1.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:98
circleOfRadius?
optionalcircleOfRadius:number
A circular physics body of the given radius centered on the node.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:8
collisionBitMask?
optionalcollisionBitMask:number
A 32-bit mask specifying which categories this physics body can collide with.
Remarks
This value is a bit mask of the other physics body categories that this body can collide with. Default is 0xFFFFFFFF, which means this body can collide with all other categories (e.g., all physics bodies).
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:106
damping?
optionaldamping:number
Friction due to air forces on the body, in the range [0, 1].
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:58
density?
optionaldensity:number
Body density (mass per unit area)
Remarks
Mass will automatically be calculated when density is set.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:76
edgeLoop?
optionaledgeLoop:Size&object
A region that physics bodies cannot penetrate.
Type declaration
thickness?
optionalthickness:number
The thickness of the edge loop. Defaults to 50.
Remarks
If body A is moving rapidly and/or is small, and body B is also small, collisions between the two bodies may not be detected. This can manifest as body A "passing through" body B. This is called "tunneling". If body B is an edge loop, one way to reduce tunneling is to increase the thickness of the edge loop. See https://github.com/liabru/matter-js/issues/5
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:16
friction?
optionalfriction:number
Friction of the body, in the range [0, 1].
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:54
isDynamic?
optionalisDynamic:boolean
Whether or not the physics body moves in response to forces. Defaults to true.
Remarks
Once set, this property cannot be changed. This is negated and mapped to the Matter.js static property.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:34
mass?
optionalmass:number
The mass of the body.
Remarks
Density will automatically be calculated when mass is set.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:70
rect?
optionalrect:Size
A rectangular physics body of the given size centered on the node.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:12
resting?
optionalresting:boolean
Whether or not the physics body currently moves in response to forces. Defaults to false.
Remarks
Unlike isDynamic, this property can be changed after the body is created. This is mapped to the Matter.js sleeping property.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:40
restitution?
optionalrestitution:number
How elastic (bouncy) the body is.
Remarks
Range is 0 to 1. 0 means collisions are not elastic at all (no bouncing), 1 means collisions are perfectly elastic. Defaults to 0. This is mapped to the Matter.js restitution property.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:46
speed?
optionalspeed:number
Body speed.
Remarks
If speed is set, the direction will be maintained when velocity is updated.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:83
velocity?
optionalvelocity:Vector
The velocity of the body.
Defined in
m2c2kit/packages/physics/src/PhysicsBodyOptions.ts:50