|
||||||||||
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 that physics takes place in.
To the extent that it is possible, avoid accessing members
directly, as in a future version their accessibility may
be rolled back - as un-Java as that is, we must follow
upstream C++ conventions, and for now everything is public
to speed development of Box2d, but it is subject to change.
You're warned!
Constructor Summary | |
---|---|
World(AABB worldAABB,
Vec2 gravity,
boolean doSleep)
Construct a world object. |
Method Summary | |
---|---|
Body |
createBody(BodyDef def)
Create a body given a definition. |
Joint |
createJoint(JointDef def)
Create a joint to constrain bodies together. |
void |
destroyBody(Body b)
Destroy a rigid body given a definition. |
void |
destroyJoint(Joint j)
Destroy a joint. |
void |
drawDebugData()
For internal use |
void |
drawJoint(Joint joint)
For internal use |
void |
drawShape(Shape shape,
XForm xf,
Color3f color,
boolean core)
For internal use |
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). |
DebugDraw |
getDebugDraw()
|
Vec2 |
getGravity()
Get a clone of the global gravity vector. |
Body |
getGroundBody()
The world provides a single static ground body with no collision shapes. |
int |
getJointCount()
Get the number of joints. |
Joint |
getJointList()
Get the world joint list. |
int |
getPairCount()
Get the number of broad-phase pairs. |
int |
getProxyCount()
Get the number of broad-phase proxies. |
AABB |
getWorldAABB()
Get the world bounding box. |
boolean |
inRange(AABB aabb)
Return true if the bounding box is within range of the world AABB. |
boolean |
isDrawingDebugData()
|
Shape[] |
query(AABB aabb,
int maxCount)
Query the world for all shapes that potentially overlap the provided AABB up to max count. |
void |
refilter(Shape shape)
Re-filter a shape. |
void |
registerPostStep(Steppable s)
Registers a Steppable object to be stepped immediately following the physics step, once the locks are lifted. |
void |
setBoundaryListener(BoundaryListener listener)
Register a broad-phase boundary listener. |
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 |
setDrawDebugData(boolean tf)
|
void |
setGravity(Vec2 gravity)
Change the global gravity vector. |
void |
setPositionCorrection(boolean flag)
Enable/disable position correction. |
void |
setWarmStarting(boolean flag)
Enable/disable warm starting. |
void |
solve(TimeStep step)
For internal use |
void |
solveTOI(TimeStep step)
For internal use: find TOI contacts and solve them. |
void |
step(float dt,
int iterations)
Take a time step. |
void |
unregisterPostStep(Steppable s)
Unregisters a method from post-stepping. |
void |
validate()
Perform validation of internal data structures. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public World(AABB worldAABB, Vec2 gravity, boolean doSleep)
worldAABB
- a bounding box that completely encompasses all your shapes.gravity
- the world gravity vector.doSleep
- improve performance by not simulating inactive bodies.Method Detail |
---|
public void setDrawDebugData(boolean tf)
public boolean isDrawingDebugData()
public int getBodyCount()
public int getJointCount()
public int getContactCount()
public void setGravity(Vec2 gravity)
public Vec2 getGravity()
public Body getGroundBody()
public Body getBodyList()
public Joint getJointList()
public void setDestructionListener(DestructionListener listener)
public void setBoundaryListener(BoundaryListener listener)
public void setContactListener(ContactListener listener)
public void setContactFilter(ContactFilter filter)
public void setDebugDraw(DebugDraw debugDraw)
public DebugDraw getDebugDraw()
public Body createBody(BodyDef def)
public void destroyBody(Body b)
public Joint createJoint(JointDef def)
public void destroyJoint(Joint j)
public void step(float dt, int iterations)
dt
- the amount of time to simulate, this should not vary.iterations
- the number of iterations to be used by the constraint solver.public void registerPostStep(Steppable s)
s
- public void unregisterPostStep(Steppable s)
s
- public void refilter(Shape shape)
public Shape[] query(AABB aabb, int maxCount)
aabb
- the query box.maxCount
- the capacity of the shapes array.
public void solve(TimeStep step)
public void solveTOI(TimeStep step)
public void drawShape(Shape shape, XForm xf, Color3f color, boolean core)
public void drawJoint(Joint joint)
public void drawDebugData()
public void setWarmStarting(boolean flag)
public void setPositionCorrection(boolean flag)
public void setContinuousPhysics(boolean flag)
public void validate()
public int getProxyCount()
public int getPairCount()
public AABB getWorldAABB()
public boolean inRange(AABB aabb)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |