Functions for interacting with Box2D bodies.
Static (immovable) body
Kinematic body
Dynamic body
Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior.
body - body
position - the world position of the body's local origin.
angle - the world position of the body's local origin.
Get the world body origin position.
body - body
position - the world position of the body's origin.
Get the angle in radians.
body - body
angle - the current world rotation angle in radians.
Get the world position of the center of mass.
body - body
center - Get the world position of the center of mass.
Get the local position of the center of mass.
body - body
center - Get the local position of the center of mass.
Set the linear velocity of the center of mass.
body - body
velocity - the new linear velocity of the center of mass.
Get the linear velocity of the center of mass.
body - body
velocity - the linear velocity of the center of mass.
Set the angular velocity.
body - body
omega - the new angular velocity in radians/second.
Get the angular velocity.
body - body
velocity - the angular velocity in radians/second.
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.
body - body
force - the world force vector, usually in Newtons (N).
point - the world position of the point of application.
Apply a force to the center of mass. This wakes up the body.
body - body
force - the world force vector, usually in Newtons (N).
Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.
body - body
torque - torque about the z-axis (out of the screen), usually in N-m.
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.
body - body
impulse - the world impulse vector, usually in N-seconds or kg-m/s.
point - the world position of the point of application.
Apply an angular impulse.
body - body
impulse - impulse the angular impulse in units of kgmm/s
Get the total mass of the body.
body - body
mass - the mass, usually in kilograms (kg).
Get the rotational inertia of the body about the local origin.
body - body
inertia - the rotational inertia, usually in kg-m^2.
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
body - body
Get the world coordinates of a point given the local coordinates.
body - body
local_vector - localPoint a point on the body measured relative the the body's origin.
vector - the same point expressed in world coordinates.
Get the world coordinates of a vector given the local coordinates.
body - body
local_vector - a vector fixed in the body.
vector - the same vector expressed in world coordinates.
Gets a local point relative to the body's origin given a world point.
body - body
world_point - a point in world coordinates.
vector - the corresponding local point relative to the body's origin.
Gets a local vector given a world vector.
body - body
world_vector - a vector in world coordinates.
vector - the corresponding local vector.
Get the world linear velocity of a world point attached to this body.
body - body
world_point - a point in world coordinates.
velocity - the world velocity of a point.
Get the world velocity of a local point.
body - body
world_point - a point in local coordinates.
velocity - the world velocity of a point.
Set the linear damping of the body.
body - body
damping - the damping
Get the linear damping of the body.
body - body
damping - the damping
Set the angular damping of the body.
body - body
damping - the damping
Get the angular damping of the body.
body - body
damping - the damping
Set the gravity scale of the body.
body - body
scale - the scale
Get the gravity scale of the body.
body - body
scale - the scale
Set the type of this body. This may alter the mass and velocity.
body - body
type - the body type
Get the type of this body.
body - body
type - the body type
Should this body be treated like a bullet for continuous collision detection?
body - body
enable - if true, the body will be in bullet mode
Is this body in bullet mode
body - body
enabled - true if the body is in bullet mode
You can disable sleeping on this body. If you disable sleeping, the body will be woken.
body - body
enable - if false, the body will never sleep, and consume more CPU
Is this body allowed to sleep
body - body
enabled - true if the body is allowed to sleep
Set the sleep state of the body. A sleeping body has very low CPU cost.
body - body
enable - flag set to false to put body to sleep, true to wake it.
Get the sleeping state of this body.
body - body
enabled - true if the body is awake, false if it's sleeping.
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.
body - body
enable - true if the body should be active
Get the active state of the body.
body - body
enabled - is the body active
Set this body to have fixed rotation. This causes the mass to be reset.
body - body
enable - true if the rotation should be fixed
Does this body have fixed rotation?
body - body
enabled - is the rotation fixed
Get the next body in the world's body list.
body - body
body - the next body
Get the parent world of this body.
body - body
world -
Print the body representation to the log output
body - body