|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jbox2d.dynamics.World
public class World
The world class manages all physics entities, dynamic simulation, and asynchronous queries. The world also contains efficient memory management facilities.
Field Summary | |
---|---|
int |
activeContacts
|
static int |
CLEAR_FORCES
|
int |
contactPoolCount
|
static int |
LOCKED
|
protected ContactManager |
m_contactManager
|
protected int |
m_flags
|
static int |
NEW_FIXTURE
|
static int |
WORLD_POOL_CONTAINER_SIZE
|
static int |
WORLD_POOL_SIZE
|
Constructor Summary | |
---|---|
World(Vec2 gravity)
|
|
World(Vec2 gravity,
IWorldPool argPool)
Construct a world object. |
Method Summary | |
---|---|
void |
clearForces()
Call this after you are done with time steps to clear the forces. |
Body |
createBody(BodyDef def)
create a rigid body given a definition. |
Joint |
createJoint(JointDef def)
create a joint to constrain bodies together. |
void |
destroyBody(Body body)
destroy a rigid body given a definition. |
void |
destroyJoint(Joint j)
destroy a joint. |
void |
drawDebugData()
Call this to draw shapes and other debug draw data. |
boolean |
getAutoClearForces()
Get the flag that controls automatic clearing of forces after each time step. |
int |
getBodyCount()
Get the number of bodies. |
Body |
getBodyList()
Get the world body list. |
int |
getContactCount()
Get the number of contacts (each may have 0 or more contact points). |
Contact |
getContactList()
Get the world contact list. |
ContactManager |
getContactManager()
Get the contact manager for testing purposes |
Vec2 |
getGravity()
Get the global gravity vector. |
int |
getJointCount()
Get the number of joints. |
Joint |
getJointList()
Get the world joint list. |
IWorldPool |
getPool()
|
Profile |
getProfile()
|
int |
getProxyCount()
Get the number of broad-phase proxies. |
int |
getTreeBalance()
Gets the balance of the dynamic tree |
int |
getTreeHeight()
Gets the height of the dynamic tree |
float |
getTreeQuality()
Gets the quality of the dynamic tree |
boolean |
isAllowSleep()
|
boolean |
isContinuousPhysics()
|
boolean |
isLocked()
Is the world locked (in the middle of a time step). |
boolean |
isSleepingAllowed()
|
boolean |
isWarmStarting()
|
Contact |
popContact(Fixture fixtureA,
int indexA,
Fixture fixtureB,
int indexB)
|
void |
pushContact(Contact contact)
|
void |
queryAABB(QueryCallback callback,
AABB aabb)
Query the world for all fixtures that potentially overlap the provided AABB. |
void |
raycast(RayCastCallback callback,
Vec2 point1,
Vec2 point2)
Ray-cast the world for all fixtures in the path of the ray. |
void |
setAllowSleep(boolean flag)
|
void |
setAutoClearForces(boolean flag)
Set flag to control automatic clearing of forces after each time step. |
void |
setContactFilter(ContactFilter filter)
Register a contact filter to provide specific control over collision. |
void |
setContactListener(ContactListener listener)
Register a contact event listener. |
void |
setContinuousPhysics(boolean flag)
Enable/disable continuous physics. |
void |
setDebugDraw(DebugDraw debugDraw)
Register a routine for debug drawing. |
void |
setDestructionListener(DestructionListener listener)
Register a destruction listener. |
void |
setGravity(Vec2 gravity)
Change the global gravity vector. |
void |
setSleepingAllowed(boolean sleepingAllowed)
|
void |
setWarmStarting(boolean flag)
Enable/disable warm starting. |
void |
step(float dt,
int velocityIterations,
int positionIterations)
Take a time step. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int WORLD_POOL_SIZE
public static final int WORLD_POOL_CONTAINER_SIZE
public static final int NEW_FIXTURE
public static final int LOCKED
public static final int CLEAR_FORCES
public int activeContacts
public int contactPoolCount
protected int m_flags
protected ContactManager m_contactManager
Constructor Detail |
---|
public World(Vec2 gravity)
public World(Vec2 gravity, IWorldPool argPool)
gravity
- the world gravity vector.doSleep
- improve performance by not simulating inactive bodies.Method Detail |
---|
public void setAllowSleep(boolean flag)
public boolean isAllowSleep()
public Contact popContact(Fixture fixtureA, int indexA, Fixture fixtureB, int indexB)
public void pushContact(Contact contact)
public IWorldPool getPool()
public void setDestructionListener(DestructionListener listener)
listener
- public void setContactFilter(ContactFilter filter)
filter
- public void setContactListener(ContactListener listener)
listener
- public void setDebugDraw(DebugDraw debugDraw)
debugDraw
- public Body createBody(BodyDef def)
def
-
public void destroyBody(Body body)
body
- public Joint createJoint(JointDef def)
def
-
public void destroyJoint(Joint j)
joint
- public void step(float dt, int velocityIterations, int positionIterations)
timeStep
- the amount of time to simulate, this should not vary.velocityIterations
- for the velocity constraint solver.positionIterations
- for the position constraint solver.public void clearForces()
setAutoClearForces
public void drawDebugData()
public void queryAABB(QueryCallback callback, AABB aabb)
callback
- a user implemented callback class.aabb
- the query box.public void raycast(RayCastCallback callback, Vec2 point1, Vec2 point2)
callback
- a user implemented callback class.point1
- the ray starting pointpoint2
- the ray ending pointpublic Body getBodyList()
public Joint getJointList()
public Contact getContactList()
public boolean isSleepingAllowed()
public void setSleepingAllowed(boolean sleepingAllowed)
public void setWarmStarting(boolean flag)
flag
- public boolean isWarmStarting()
public void setContinuousPhysics(boolean flag)
flag
- public boolean isContinuousPhysics()
public int getProxyCount()
public int getBodyCount()
public int getJointCount()
public int getContactCount()
public int getTreeHeight()
public int getTreeBalance()
public float getTreeQuality()
public void setGravity(Vec2 gravity)
gravity
- public Vec2 getGravity()
public boolean isLocked()
public void setAutoClearForces(boolean flag)
flag
- public boolean getAutoClearForces()
public ContactManager getContactManager()
public Profile getProfile()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |