public class BodyDef
- Object
- BodyDef
A body definition holds all the data needed to construct a rigid body.
You can safely re-use body definitions. Shapes are added to a body
after construction.
Fields
public BodyType type | The body type: static, kinematic, or dynamic. |
public Object userData | Use this to store application specific body data. |
public Vec2 position | The world position of the body. |
public float angle | The world angle of the body in radians. |
public Vec2 linearVelocity | The linear velocity of the body in world co-ordinates. |
public float angularVelocity | The angular velocity of the body. |
public float linearDamping | Linear damping is use to reduce the linear velocity. |
public float angularDamping | Angular damping is use to reduce the angular velocity. |
public boolean allowSleep | Set this flag to false if this body should never fall asleep. |
public boolean awake | Is this body initially sleeping? |
public boolean fixedRotation | Should this body be prevented from rotating? Useful for characters. |
public boolean bullet | Is this a fast moving body that should be prevented from tunneling through other moving bodies? Note that all bodies are prevented from tunneling through kinematic and static bodies. |
public boolean active | Does this body start out active? |
public float gravityScale | Experimental: scales the inertia tensor. |
Constructors
public BodyDef() |
Inherited methods
Field details
type
public BodyType typeThe body type: static, kinematic, or dynamic.
Note: if a dynamic body would have zero mass, the mass is set to one.
userData
public Object userDataUse this to store application specific body data.
position
public Vec2 positionThe world position of the body. Avoid creating bodies at the origin
since this can lead to many overlapping shapes.
angle
public float angleThe world angle of the body in radians.
linearVelocity
public Vec2 linearVelocityThe linear velocity of the body in world co-ordinates.
angularVelocity
public float angularVelocityThe angular velocity of the body.
linearDamping
public float linearDampingLinear damping is use to reduce the linear velocity. The damping parameter
can be larger than 1.0f but the damping effect becomes sensitive to the
time step when the damping parameter is large.
angularDamping
public float angularDampingAngular damping is use to reduce the angular velocity. The damping parameter
can be larger than 1.0f but the damping effect becomes sensitive to the
time step when the damping parameter is large.
allowSleep
public boolean allowSleepSet this flag to false if this body should never fall asleep. Note that
this increases CPU usage.
awake
public boolean awakeIs this body initially sleeping?
fixedRotation
public boolean fixedRotationShould this body be prevented from rotating? Useful for characters.
bullet
public boolean bulletIs this a fast moving body that should be prevented from tunneling through
other moving bodies? Note that all bodies are prevented from tunneling through
kinematic and static bodies. This setting is only considered on dynamic bodies.
Warning. You should use this flag sparingly since it increases processing time.
active
public boolean activeDoes this body start out active?
gravityScale
public float gravityScaleExperimental: scales the inertia tensor.
Constructor details
BodyDef
public BodyDef()