Bounding box of this body. Update with Body.updateAABB.
Indicates if the AABB needs update. Update it with {@link "Body.updateAABB"}.
If true, the body will automatically fall to sleep. Note that you need to enable sleeping in the World before anything will happen.
The angle of the body, in radians.
The angular force acting on the body. Should be a value between 0 and 1.
The angular force acting on the body. See Body.force.
The angular velocity of the body, in radians per second.
Bounding circle radius. Update with Body.updateBoundingRadius.
The number of iterations that should be used when searching for the time of impact during CCD. A larger number will assure that there's a small penetration on CCD collision, but a small number will give more performance.
If the body speed exceeds this threshold, CCD (continuous collision detection) will be enabled. Set it to a negative number to disable CCD completely for this body.
Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled. That means that this body will move through other bodies, but it will still trigger contact events, etc.
The linear damping acting on the body in the velocity direction. Should be a value between 0 and 1.
Set to true if you want to fix the rotation of the body.
Set to true if you want to fix the body movement along the X axis. The body will still be able to move along Y.
Set to true if you want to fix the body movement along the Y axis. The body will still be able to move along X. See .fixedX
The force acting on the body. Since the body force (and Body.angularForce) will be zeroed after each step, so you need to set the force before each step.
Gravity scaling factor. If you want the body to ignore gravity, set this to zero. If you want to reverse gravity, set it to -1.
The body identifier
How long the body has been sleeping.
Index of the body in the World .bodies array. Is set to -1 if the body isn't added to a World.
The inertia of the body around the Z axis.
The interpolated angle of the body. Use this for rendering.
The interpolated position of the body. Use this for rendering.
The inverse inertia of the body.
The inverse mass of the body.
The mass of the body. If you change this number, you should call Body.updateMassProperties.
The position of the body in the world. Don't use this for rendering, instead use .interpolatedPosition
The previous angle of the body.
The previous position of the body.
The shapes of the body.
If the speed (the norm of the velocity) is smaller than this value, the body is considered sleepy.
One of Body.AWAKE, Body.SLEEPY and Body.SLEEPING.
The body is initially Body.AWAKE. If its velocity norm is below .sleepSpeedLimit, the sleepState will become Body.SLEEPY. If the body continues to be Body.SLEEPY for .sleepTimeLimit seconds, it will fall asleep (Body.SLEEPY).
If the body has been sleepy for this sleepTimeLimit seconds, it is considered sleeping.
The last time when the body went to SLEEPY state.
The type of motion this body has. Should be one of: Body.STATIC, Body.DYNAMIC and Body.KINEMATIC.
The current velocity of the body.
Constraint velocity that was added to the body during the last step.
Whether the body wants to sleep
Angular constraint velocity that was added to the body during last step.
The world that this body is added to (read only). This property is set to NULL if the body is not added to any world.
Awake sleep state.
Dynamic body.
Kinematic body.
Sleeping sleep state.
Sleepy sleep state.
Static body.
Id counter for Body instances
Add a shape to the body. You can pass a local transform when adding a shape, so that the shape gets an offset and angle relative to the body center of mass. Will automatically update the mass properties and bounding radius.
Local body offset of the shape.
Local body angle.
Moves the shape offsets so their center of mass becomes the body center of mass.
Apply damping, see this for details.
Current time step
Apply force to a point relative to the center of mass of the body. This could for example be a point on the Body surface. Applying force this way will add to Body.force and Body.angularForce.
The force vector to add, oriented in world space.
A point relative to the body in world space. If not given, it is set to zero and all of the force will be exerted on the center of mass.
Apply force to a point relative to the center of mass of the body. This could for example be a point on the Body surface. Applying force this way will add to Body.force and Body.angularForce.
The force vector to add, oriented in local body space.
A point relative to the body in local body space. If not given, it is set to zero and all of the force will be exerted on the center of mass.
Apply impulse to a point relative to 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.
The impulse vector to add, oriented in world space.
A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be exerted on the center of mass.
Apply impulse to a point relative to 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.
The impulse vector to add, oriented in local body space.
A point relative to the body in local body space. If not given, it is set to zero and all of the impulse will be exerted on the center of mass.
Emit an event.
The self object, for chainability.
Reads a polygon shape path, and assembles convex shapes from that and puts them at proper offset points.
An array of 2d vectors, e.g. [[0,0],[0,1],...] that resembles a concave or convex polygon. The shape must be simple and without holes.
True on success, else false.
Get the AABB from the body. The AABB is updated if necessary.
The AABB instance from the body.
Get the total area of all shapes in the body
total area of all shapes in the body
Check if an event listener is added
Move the body forward in time given its current velocity.
Remove an event listener
The self object, for chainability.
Add an event listener
The self object, for chainability.
Check if the body is overlapping another body. Note that this method only works if the body was added to a World and if at least one step was taken.
if the body overlaps the given body
Remove a shape.
True if the shape was found and removed, else false.
Set the total density of the body
Sets the force on the body to zero.
Force body sleep
Called every timestep to update internal sleep timer and change sleep state if needed.
The world time in seconds
Updates the AABB of the Body, and set .aabbNeedsUpdate = false.
Update the bounding radius of the body (this.boundingRadius). Should be done if any of the shape dimensions or positions are changed.
Updates .inertia, .invMass, .invInertia for this Body. Should be called when changing the structure or mass of the Body.
Wake the body up. Normally you should not need this, as the body is automatically awoken at events such as collisions. Sets the sleepState to Body.AWAKE and emits the wakeUp event if the body wasn't awake before.
A rigid body. Has got a center of mass, position, velocity and a number of shapes that are used for collisions.