A rigid body.
Dynamic Body
Kinematic Body
Static Body
Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.
Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.
Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.
Force applied about the z-axis (out of the screen), usually in N-m.
Creates a fixture and attach it to this body. Use this function if you need to set some fixture parameters, like friction. Otherwise you can create the fixture directly from a shape. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step.
The fixture definition;
The created fixture.
Creates a fixture from a shape and attach it to this body. This is a convenience function. Use b2FixtureDef if you need to set parameters like friction, restitution, user data, or filtering. This function automatically updates the mass of the body.
The shaped of the fixture (to be cloned).
The shape density, default is 0.0, set to zero for static bodies.
The created fixture.
Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly destroyed when the body is destroyed.
The fixed to be removed.
Get the angle in radians.
number
The current world rotation angle in radians
Get the angular damping of the body.
number
Angular damping of the body.
Get the angular velocity.
number
The angular velocity in radians/second.
Get the list of all contacts attached to this body.
List of all contacts attached to this body.
Get the list of all controllers attached to this body.
List of all controllers attached to this body.
Get the definition containing the body properties.
The body's definition.
Get the list of all fixtures attached to this body.
List of all fixtures attached to this body.
Get the central rotational inertia of the body.
number
The rotational inertia, usually in kg-m^2.
Get the list of all joints attached to this body.
List of all joints attached to this body.
Get the linear damping of the body.
number
The linear damping of the body.
Get the linear velocity of the center of mass.
The linear velocity of the center of mass.
Get the world velocity of a local point.
Point in local coordinates.
The world velocity of the point.
Get the world linear velocity of a world point attached to this body.
Point in world coordinates.
The world velocity of the point.
Get the local position of the center of mass.
Local position of the center of mass.
Gets a local point relative to the body's origin given a world point.
Pointin world coordinates.
The corresponding local point relative to the body's origin.
Gets a local vector given a world vector.
World vector.
The corresponding local vector.
Get the total mass of the body.
number
The body's mass, usually in kilograms (kg).
Get the mass data of the body. The rotational inertial is relative to the center of mass.
Body's mass data, this argument is out
.
Get the next body in the world's body list.
Next body in the world's body list.
Get the world body origin position.
World position of the body's origin.
Get the body transform for the body's origin.
World transform of the body's origin.
Get the type of this body.
number
Body type as uint.
Get the user data pointer that was provided in the body definition.
any
User's data, cast to the correct type.
Get the parent world of this body.
Body's world.
Get the world position of the center of mass.
World position of the center of mass.
Get the world coordinates of a point given the local coordinates.
Point on the body measured relative to the body's origin.
localPoint expressed in world coordinates.
Get the world coordinates of a vector given the local coordinates.
Vector fixed in the body.
localVector expressed in world coordinates.
Get the active state of the body.
boolean
True if the body is active, otherwise false.
Get the sleeping state of this body.
boolean
True if the body is awake, otherwise false.
Is the body treated like a bullet for continuous collision detection?
boolean
True if the body is treated like a bullet, otherwise false.
Does this body have fixed rotation?
boolean
True for fixed, otherwise false.
Is this body allowed to sleep?
boolean
True if the body can sleep, otherwise false.
Merges another body into this. Only fixtures, mass and velocity are effected, Other properties are ignored.
This resets the mass properties to the sum of the mass properties of the fixtures. This normally does not need to be called unless you called SetMassData to override the mass and later you want to reset the mass.
Set the active state of the body. An inactive body is not simulated and cannot be collided with or woken up. If you pass a flag of true, all fixtures will be added to the broad-phase. If you pass a flag of false, all fixtures will be removed from the broad-phase and all contacts will be destroyed. Fixtures and joints are otherwise unaffected. You may continue to create/destroy fixtures and joints on inactive bodies. Fixtures on an inactive body are implicitly inactive and will not participate in collisions, ray-casts, or queries. Joints connected to an inactive body are implicitly inactive. An inactive body is still owned by a b2World object and remains in the body list.
True to activate, false to deactivate.
Set the world body angle
New angle of the body.
Set the angular damping of the body.
New angular damping value.
Set the angular velocity.
New angular velocity in radians/second.
Set the sleep state of the body. A sleeping body has vety low CPU cost.
True to set the body to awake, false to put it to sleep.
Should this body be treated like a bullet for continuous collision detection?
True for bullet, false for normal.
Set this body to have fixed rotation. This causes the mass to be reset.
True for no rotation, false to allow for rotation.
Set the linear damping of the body.
The new linear damping for this body.
Set the linear velocity of the center of mass.
New linear velocity of the center of mass.
Set the mass properties to override the mass properties of the fixtures Note that this changes the center of mass position. Note that creating or destroying fixtures can also alter the mass. This function has no effect if the body isn't dynamic.
New mass data properties.
Set the world body origin position.
New world body origin position.
Set the position of the body's origin and rotation (radians). This breaks any contacts and wakes the other bodies.
New world body origin position.
New world rotation angle of the body in radians.
Is this body allowed to sleep
True if the body can sleep, false if not.
Set the position of the body's origin and rotation (radians). This breaks any contacts and wakes the other bodies. Note this is less efficient than the other overload - you should use that if the angle is available.
Body's origin and rotation (radians).
Set the type of this body. This may alter the mass and velocity
Type enum.
Set the user data. Use this to store your application specific data.
The user data for this body.
Splits a body into two, preserving dynamic properties
The newly created bodies from the split.