com.badlogic.gdx.physics.box2d
Class BodyDef

java.lang.Object
  extended by com.badlogic.gdx.physics.box2d.BodyDef

public class BodyDef
extends Object

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.

Author:
mzechner

Nested Class Summary
static class BodyDef.BodyType
          The body type.
 
Field Summary
 boolean active
          Does this body start out active?
 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.
 float angularVelocity
          The angular velocity of the body.
 boolean awake
          Is this body initially awake or sleeping?
 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.
 boolean fixedRotation
          Should this body be prevented from rotating? Useful for characters.
 float gravityScale
          Scale the gravity applied to this body.
 float linearDamping
          Linear damping is use to reduce the linear velocity.
 Vector2 linearVelocity
          The linear velocity of the body's origin in world co-ordinates.
 Vector2 position
          The world position of the body.
 BodyDef.BodyType type
          The body type: static, kinematic, or dynamic.
 
Constructor Summary
BodyDef()
           
 
Method Summary
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public BodyDef.BodyType type
The body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one.


position

public final Vector2 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.


linearVelocity

public final Vector2 linearVelocity
The linear velocity of the body's origin in world co-ordinates.


angularVelocity

public float angularVelocity
The angular velocity of the body.


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.


awake

public boolean awake
Is this body initially awake or sleeping?


fixedRotation

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


bullet

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. This setting is only considered on dynamic bodies.


active

public boolean active
Does this body start out active?


gravityScale

public float gravityScale
Scale the gravity applied to this body.

Constructor Detail

BodyDef

public BodyDef()


Copyright © 2013. All Rights Reserved.