Optional
options: { Optional
allowIf true, the body will automatically fall to sleep.
true
Optional
angularHow much to damp the body angular velocity each step. It can go from 0 to 1.
0.01
Optional
angularUse this property to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none.
Optional
angularAngular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates.
Optional
collisionThe collision group the body belongs to.
1
Optional
collisionThe collision group the body can collide with.
-1
Optional
collisionWhether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled - i.e. "collide" events will be raised, but forces will not be altered.
Optional
fixedSet to true if you don't want the body to rotate. Make sure to run .updateMassProperties() if you change this after the body creation.
false
Optional
isWhen true the body behaves like a trigger. It does not collide with other bodies but collision events are still triggered.
false
Optional
linearHow much to damp the body velocity each step. It can go from 0 to 1.
0.01
Optional
linearUse this property to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none.
Optional
mass?: numberThe mass of the body.
0
Optional
material?: MaterialThe physics material of the body. It defines the body interaction with other bodies.
Optional
position?: Vec3World space position of the body.
Optional
quaternion?: QuaternionWorld space orientation of the body.
Optional
shape?: ShapeAdd a Shape to the body.
Optional
sleepIf the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy.
0.1
Optional
sleepIf the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping.
1
Optional
type?: BodyTypeOne of: Body.DYNAMIC
, Body.STATIC
and Body.KINEMATIC
.
Optional
velocity?: Vec3World space velocity of the body.
World space bounding box of the body and its shapes.
Indicates if the AABB needs to be updated before use.
If true, the body will automatically fall to sleep.
true
How much to damp the body angular velocity each step. It can go from 0 to 1.
0.01
Use this property to limit the rotational motion along any world axis. (1,1,1) will allow rotation along all axes while (0,0,0) allows none.
Angular velocity of the body, in world space. Think of the angular velocity as a vector, which the body rotates around. The length of this vector determines how fast (in radians per second) the body rotates.
Total bounding radius of the Body including its shapes, relative to body.position.
The collision group the body belongs to.
1
The collision group the body can collide with.
-1
Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled - i.e. "collide" events will be raised, but forces will not be altered.
Optional
entitySet to true if you don't want the body to rotate. Make sure to run .updateMassProperties() if you change this after the body creation.
false
Linear force on the body in world space.
Identifier of the body.
Position of body in World.bodies. Updated by World and used in ArrayCollisionMatrix.
The inertia of the body.
Initial angular velocity of the body.
Initial position of the body.
Initial quaternion of the body.
Initial velocity of the body.
Interpolated position of the body.
Interpolated orientation of the body.
When true the body behaves like a trigger. It does not collide with other bodies but collision events are still triggered.
false
How much to damp the body velocity each step. It can go from 0 to 1.
0.01
Use this property to limit the motion along any world axis. (1,1,1) will allow motion along all axes while (0,0,0) allows none.
The mass of the body.
0
The physics material of the body. It defines the body interaction with other bodies.
Optional
object3dWorld space position of the body.
World space orientation of the body.
Position of each Shape in the body, given in local Body space.
Orientation of each Shape, given in local Body space.
List of Shapes that have been added to the body.
If the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy.
0.1
Current sleep state.
If the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping.
1
World space rotational force on the body, around center of mass.
One of: Body.DYNAMIC
, Body.STATIC
and Body.KINEMATIC
.
World space velocity of the body.
Reference to the world the body is living in.
Static
AWAKEAWAKE
Static
DYNAMICA dynamic body is fully simulated. Can be moved manually by the user, but normally they move according to forces. A dynamic body can collide with all body types. A dynamic body always has finite, non-zero mass.
Static
KINEMATICA kinematic body moves under simulation according to its velocity. They do not respond to forces. They can be moved manually, but normally a kinematic body is moved by setting its velocity. A kinematic body behaves as if it has infinite mass. Kinematic bodies do not collide with other static or kinematic bodies.
Static
SLEEPINGSLEEPING
Static
SLEEPYSLEEPY
Static
STATICA static body does not move during simulation and behaves as if it has infinite mass. Static bodies can be moved manually by setting the position of the body. The velocity of a static body is always zero. Static bodies do not collide with other static or kinematic bodies.
Static
idAdd an event listener
The self object, for chainability.
Add a shape to the body with a local offset and orientation.
Optional
_offset: Vec3Optional
_orientation: QuaternionThe body object, for chainability.
Apply impulse to a point of the body. This could for example be a point on the Body surface. An impulse is a force added to a body during a short period of time (impulse = force * time). Impulses will be added to Body.velocity and Body.angularVelocity.
Apply torque to the body.
The amount of torque to add.
Emit an event.
The self object, for chainability.
Remove an event listener
The self object, for chainability.
Static
COLLIDE_Dispatched after two bodies collide. This event is dispatched on each of the two bodies involved in the collision. collide
The body that was involved in the collision.
The details of the collision.
Static
sleepDispatched after a body has fallen asleep. sleep
Static
sleepyDispatched after a body has gone in to the sleepy state. sleepy
Static
wakeupDispatched after a sleeping body has woken up. wakeup
Base class for all body types.
Example