Static
b2_Dynamic Body
Static
b2_Kinematic Body
Static
b2_Static Body
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).
Optional
density: numberThe 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 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 list of all joints attached to this body.
List of all joints attached to this body.
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 body transform for the body's origin.
World transform of the body's origin.
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 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 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.
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).
A rigid body.