org.jbox2d.dynamics
Class BodyDef

java.lang.Object
  extended by org.jbox2d.dynamics.BodyDef

public class BodyDef
extends java.lang.Object

Defines a body. All data is public, and may be set directly. When you have set the definition to your liking, you can create the body using World::createDynamicBody(BodyDef) or World::createStaticBody(BodyDef).

Don't forget to call Body::setMassFromShapes or Body::setMass(MassData) after you create a dynamic body!


Field Summary
 boolean allowSleep
          Set this flag to false if this body should never fall asleep.
 float angle
          The world angle of the body in radians.
 float angularDamping
          Angular damping is use to reduce the angular velocity.
 boolean fixedRotation
          Should this body be prevented from rotating? Useful for characters.
 boolean isBullet
          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 static bodies.
 boolean isSleeping
          Is this body initially sleeping?
 float linearDamping
          Linear damping is use to reduce the linear velocity.
 MassData massData
          You can use this to initialized the mass properties of the body.
 Vec2 position
          The world position of the body.
 java.lang.Object userData
          Use this to store application specific body data
 
Constructor Summary
BodyDef()
          Default body definition.
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

massData

public MassData massData
You can use this to initialized the mass properties of the body. If you prefer, you can set the mass properties after the shapes have been added using Body::setMassFromShapes.


userData

public java.lang.Object userData
Use this to store application specific body data


position

public Vec2 position
The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.


angle

public float angle
The world angle of the body in radians.


linearDamping

public float linearDamping
Linear 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 angularDamping
Angular 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 allowSleep
Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.


isSleeping

public boolean isSleeping
Is this body initially sleeping?


fixedRotation

public boolean fixedRotation
Should this body be prevented from rotating? Useful for characters.


isBullet

public boolean isBullet
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 static bodies.

Warning: You should use this flag sparingly since it increases processing time.

Constructor Detail

BodyDef

public BodyDef()
Default body definition. Defines a body with the following characteristics: