public class World
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
World(Vec2 gravity)
Construct a world object.
|
World(Vec2 gravity,
IWorldPool pool)
Construct a world object.
|
World(Vec2 gravity,
IWorldPool argPool,
BroadPhaseStrategy broadPhaseStrategy) |
Modifier and Type | Method and Description |
---|---|
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 |
isSubStepping() |
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 |
setSubStepping(boolean subStepping) |
void |
setWarmStarting(boolean flag)
Enable/disable warm starting.
|
void |
step(float dt,
int velocityIterations,
int positionIterations)
Take a time step.
|
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
public World(Vec2 gravity)
gravity
- the world gravity vector.public World(Vec2 gravity, IWorldPool pool)
gravity
- the world gravity vector.public World(Vec2 gravity, IWorldPool argPool, BroadPhaseStrategy broadPhaseStrategy)
public void setAllowSleep(boolean flag)
public void setSubStepping(boolean subStepping)
public boolean isSubStepping()
public boolean isAllowSleep()
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()
Copyright © 2017. All Rights Reserved.