|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jbox2d.dynamics.Body
public class Body
Field Summary | |
---|---|
static int |
e_allowSleepFlag
|
static int |
e_bulletFlag
|
static int |
e_dynamicType
|
static int |
e_fixedRotationFlag
|
static int |
e_frozenFlag
|
static int |
e_islandFlag
|
static int |
e_maxTypes
|
static int |
e_sleepFlag
|
static int |
e_staticType
|
float |
m_angularDamping
|
float |
m_angularVelocity
|
ContactEdge |
m_contactList
|
int |
m_flags
|
Vec2 |
m_force
|
float |
m_I
|
float |
m_invI
|
float |
m_invMass
|
JointEdge |
m_jointList
|
float |
m_linearDamping
|
Vec2 |
m_linearVelocity
|
float |
m_mass
|
Body |
m_next
|
Body |
m_prev
|
int |
m_shapeCount
|
Shape |
m_shapeList
|
float |
m_sleepTime
|
Sweep |
m_sweep
The swept motion for CCD |
float |
m_torque
|
int |
m_type
|
java.lang.Object |
m_userData
A holder to attach external data to a body. |
World |
m_world
|
XForm |
m_xf
The body origin transform |
Constructor Summary | |
---|---|
Body(BodyDef bd,
int type,
World world)
Should not be called by user, as it will not be properly added to the world. |
Method Summary | |
---|---|
void |
advance(float t)
For internal use only. |
void |
allowSleeping(boolean flag)
Set to false to prevent this body from sleeping due to inactivity. |
void |
applyForce(Vec2 force,
Vec2 point)
Apply a force at a world point. |
void |
applyImpulse(Vec2 impulse,
Vec2 point)
Apply an impulse at a point. |
void |
applyTorque(float torque)
Apply a torque. |
void |
computeMass()
For internal use only. |
Shape |
createShape(ShapeDef def)
Creates a shape and attach it to this body. |
void |
destroyShape(Shape s)
Destroy a shape. |
float |
getAngle()
Get the angle in radians. |
float |
getAngularVelocity()
Get the angular velocity. |
ContactEdge |
getContactList()
Get the linked list of all contacts attached to this body. |
float |
getInertia()
Get the central rotational inertia of the body. |
JointEdge |
getJointList()
Get the linked list of all joints attached to this body. |
Vec2 |
getLinearVelocity()
Get a copy of the linear velocity of the center of mass. |
Vec2 |
getLocalCenter()
Get a copy of the local position of the center of mass. |
Vec2 |
getLocalPoint(Vec2 worldPoint)
Gets a local point relative to the body's origin given a world point. |
Vec2 |
getLocalVector(Vec2 worldVector)
Gets a local vector given a world vector. |
float |
getMass()
Get the total mass of the body. |
Body |
getNext()
Get the next body in the world's body list. |
Vec2 |
getPosition()
Get a copy of the world body origin position. |
Shape |
getShapeList()
Get the linked list of all shapes attached to this body. |
java.lang.Object |
getUserData()
Get the user data Object reference that was provided in the body definition. |
Vec2 |
getWorldCenter()
Get a copy of the world position of the center of mass. |
Vec2 |
getWorldPoint(Vec2 localPoint)
Get the world coordinates of a point given the local coordinates. |
Vec2 |
getWorldVector(Vec2 localVector)
Get the world coordinates of a vector given the local coordinates. |
XForm |
getXForm()
Get a copy of the body transform for the body's origin. |
boolean |
isBullet()
Is this body treated like a bullet for continuous collision detection? |
boolean |
isConnected(Body other)
This is used to prevent connected bodies from colliding. |
boolean |
isDynamic()
Is this body dynamic (movable)? |
boolean |
isFrozen()
Is this body frozen? |
boolean |
isSleeping()
Is this body sleeping (not simulating). |
boolean |
isStatic()
Is this body static (immovable)? |
void |
setAngularVelocity(float omega)
Set the angular velocity. |
void |
setBullet(boolean flag)
Should this body be treated like a bullet for continuous collision detection? Use sparingly, as continuous collision detection can be expensive. |
void |
setLinearVelocity(Vec2 v)
Set the linear velocity of the center of mass. |
void |
setMass(MassData massData)
Set the mass properties. |
void |
setMassFromShapes()
Compute the mass properties from the attached shapes. |
boolean |
setXForm(Vec2 position,
float angle)
Set the position of the body's origin and rotation (radians). |
boolean |
synchronizeShapes()
For internal use only. |
void |
synchronizeTransform()
For internal use only. |
void |
wakeUp()
Wake up this body so it will begin simulating. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int e_frozenFlag
public static final int e_islandFlag
public static final int e_sleepFlag
public static final int e_allowSleepFlag
public static final int e_bulletFlag
public static final int e_fixedRotationFlag
public int m_flags
public static final int e_staticType
public static final int e_dynamicType
public static final int e_maxTypes
public int m_type
public XForm m_xf
public Sweep m_sweep
public Vec2 m_linearVelocity
public float m_angularVelocity
public Vec2 m_force
public float m_torque
public World m_world
public Body m_prev
public Body m_next
public Shape m_shapeList
public int m_shapeCount
public JointEdge m_jointList
public ContactEdge m_contactList
public float m_mass
public float m_invMass
public float m_I
public float m_invI
public float m_linearDamping
public float m_angularDamping
public float m_sleepTime
public java.lang.Object m_userData
Constructor Detail |
---|
public Body(BodyDef bd, int type, World world)
bd
- Body definitiontype
- Body.e_dynamicType or Body.e_staticTypeworld
- World to create body inMethod Detail |
---|
public Shape createShape(ShapeDef def)
def
- the shape definition.public void destroyShape(Shape s)
s
- the shape to be removed.public void setMass(MassData massData)
massData
- the mass properties.public void setMassFromShapes()
public boolean setXForm(Vec2 position, float angle)
position
- the new world position of the body's origin (not necessarily
the center of mass).angle
- the new world rotation angle of the body in radians.
public XForm getXForm()
public Vec2 getPosition()
public float getAngle()
public Vec2 getWorldCenter()
public Vec2 getLocalCenter()
public void setLinearVelocity(Vec2 v)
v
- the new linear velocity of the center of mass.public Vec2 getLinearVelocity()
public void setAngularVelocity(float omega)
omega
- the new angular velocity in radians/second.public float getAngularVelocity()
public void applyForce(Vec2 force, Vec2 point)
force
- the world force vector, usually in Newtons (N).point
- the world position of the point of application.public void applyTorque(float torque)
torque
- about the z-axis (out of the screen), usually in N-m.public void applyImpulse(Vec2 impulse, Vec2 point)
impulse
- the world impulse vector, usually in N-seconds or kg-m/s.point
- the world position of the point of application.public float getMass()
public float getInertia()
public Vec2 getWorldPoint(Vec2 localPoint)
localPoint
- a point on the body measured relative the the body's origin.
public Vec2 getWorldVector(Vec2 localVector)
localVector
- a vector fixed in the body.
public Vec2 getLocalPoint(Vec2 worldPoint)
worldPoint
- a point in world coordinates.
public Vec2 getLocalVector(Vec2 worldVector)
worldVector
- a vector in world coordinates.
public boolean isBullet()
public void setBullet(boolean flag)
public boolean isStatic()
public boolean isDynamic()
public boolean isFrozen()
public boolean isSleeping()
public void allowSleeping(boolean flag)
public void wakeUp()
public Shape getShapeList()
public JointEdge getJointList()
public ContactEdge getContactList()
public Body getNext()
public java.lang.Object getUserData()
public void computeMass()
public boolean synchronizeShapes()
public void synchronizeTransform()
public boolean isConnected(Body other)
public void advance(float t)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |