APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.physics.box2d

public Class BodyDef

extends Object
Class Inheritance
Imports
com.badlogic.gdx.math.Vector2

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 and Inner Type Summary

Modifier and TypeClass and Description
public static enum
BodyDef.BodyType

The body type.

Field Summary

Modifier and TypeField and Description
public boolean
active

Does this body start out active?

public boolean
allowSleep

Set this flag to false if this body should never fall asleep.

public float
angle

The world angle of the body in radians.

public float
angularDamping

Angular damping is use to reduce the angular velocity.

public float
angularVelocity

The angular velocity of the body.

public boolean
awake

Is this body initially awake or sleeping?

public boolean
bullet

Is this a fast moving body that should be prevented from tunneling through other moving bodies?

public boolean
fixedRotation

Should this body be prevented from rotating?

public float
gravityScale

Scale the gravity applied to this body.

public float
linearDamping

Linear damping is use to reduce the linear velocity.

public final Vector2
linearVelocity

The linear velocity of the body's origin in world co-ordinates.

public final Vector2
position

The world position of the body.

public BodyDef.BodyType
type

The body type: static, kinematic, or dynamic.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

activeback to summary
public boolean active

Does this body start out active?

allowSleepback to summary
public boolean allowSleep

Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.

angleback to summary
public float angle

The world angle of the body in radians.

angularDampingback to summary
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.

angularVelocityback to summary
public float angularVelocity

The angular velocity of the body.

awakeback to summary
public boolean awake

Is this body initially awake or sleeping?

bulletback to summary
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.

fixedRotationback to summary
public boolean fixedRotation

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

gravityScaleback to summary
public float gravityScale

Scale the gravity applied to this body.

linearDampingback to summary
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.

linearVelocityback to summary
public final Vector2 linearVelocity

The linear velocity of the body's origin in world co-ordinates.

positionback to summary
public final Vector2 position

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

typeback to summary
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.

Constructor Detail

BodyDefback to summary
public BodyDef()
com.badlogic.gdx.physics.box2d back to summary

public final Enum BodyDef.BodyType

extends Enum<BodyDef.BodyType>
Class Inheritance

The body type. static: zero mass, zero velocity, may be manually moved kinematic: zero mass, non-zero velocity set by user, moved by solver dynamic: positive mass, non-zero velocity determined by forces, moved by solver

Field Summary

Modifier and TypeField and Description
public static final BodyDef.BodyType
public static final BodyDef.BodyType
public static final BodyDef.BodyType
private int

Constructor Summary

AccessConstructor and Description
private
BodyType(int value)

Method Summary

Modifier and TypeMethod and Description
public int
public static BodyDef.BodyType
public static BodyDef.BodyType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DynamicBodyback to summary
public static final BodyDef.BodyType DynamicBody
KinematicBodyback to summary
public static final BodyDef.BodyType KinematicBody
StaticBodyback to summary
public static final BodyDef.BodyType StaticBody
valueback to summary
private int value

Constructor Detail

BodyTypeback to summary
private BodyType(int value)

Method Detail

getValueback to summary
public int getValue()
valueOfback to summary
public static BodyDef.BodyType valueOf(String name)
valuesback to summary
public static BodyDef.BodyType[] values()