| Modifier and Type | Field and Description |
|---|---|
| protected final long | addr
the address of the world instance |
| protected final LongMap | bodies
all known bodies |
| private final Contact | |
| private long[] | |
| protected ContactFilter | contactFilter
Contact filter |
| protected ContactListener | contactListener
Contact listener |
| private final Array | |
| protected final LongMap | fixtures
all known fixtures |
| protected final Pool | freeBodies
pool for bodies |
| private final Array | |
| protected final Pool | freeFixtures
pool for fixtures |
| pack-priv final Vector2 | |
| private final ContactImpulse | |
| protected final LongMap | joints
all known joints |
| private final Manifold | |
| private QueryCallback | |
| private RayCastCallback | |
| private Vector2 | |
| private Vector2 | |
| pack-priv final float[] | tmpGravity
Get the global gravity vector. |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | |
| private boolean | Returns: whether the things collidedInternal method called from JNI in case a contact happens |
| public Body | |
| public Joint | |
| private long | |
| pack-priv void | deactivateBody(Body body)
Internal method for body deactivation with notifying custom contact listener |
| public void | |
| pack-priv void | destroyFixture(Body body, Fixture fixture)
Internal method for fixture destruction with notifying custom contact listener |
| public void | |
| public void | dispose()
Implements com. Releases all resources of this object. |
| private void | |
| public boolean | |
| public void | |
| public int | |
| public int | |
| public Array | Returns: the contact listReturns the list of |
| public int | |
| public void | getFixtures(Array<Fixture>
an Array in which to place all fixtures currently in the simulation fixtures)
|
| public Vector2 | |
| public int | |
| public void | |
| public int | |
| private boolean | Returns: whether the native default ContactFilter should be usedInternal method called from JNI |
| public static native float | |
| public boolean | |
| private native void | |
| private native long | jniCreateBody(long addr, int type, float positionX, float positionY, float angle, float linearVelocityX, float linearVelocityY, float angularVelocity, float linearDamping, float angularDamping, boolean allowSleep, boolean awake, boolean fixedRotation, boolean bullet, boolean active, float inertiaScale)
|
| private native long | jniCreateDistanceJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float length, float frequencyHz, float dampingRatio)
|
| private native long | jniCreateFrictionJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float maxForce, float maxTorque)
|
| private native long | jniCreateGearJoint(long addr, long bodyA, long bodyB, boolean collideConnected, long joint1, long joint2, float ratio)
|
| private native long | jniCreateMotorJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float linearOffsetX, float linearOffsetY, float angularOffset, float maxForce, float maxTorque, float correctionFactor)
|
| private native long | jniCreateMouseJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float targetX, float targetY, float maxForce, float frequencyHz, float dampingRatio)
|
| private native long | jniCreatePrismaticJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float localAxisAX, float localAxisAY, float referenceAngle, boolean enableLimit, float lowerTranslation, float upperTranslation, boolean enableMotor, float maxMotorForce, float motorSpeed)
|
| private native long | jniCreatePulleyJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float groundAnchorAX, float groundAnchorAY, float groundAnchorBX, float groundAnchorBY, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float lengthA, float lengthB, float ratio)
|
| private native long | jniCreateRevoluteJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float referenceAngle, boolean enableLimit, float lowerAngle, float upperAngle, boolean enableMotor, float motorSpeed, float maxMotorTorque)
|
| private native long | jniCreateRopeJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float maxLength)
|
| private native long | jniCreateWeldJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float referenceAngle, float frequencyHz, float dampingRatio)
|
| private native long | jniCreateWheelJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float localAxisAX, float localAxisAY, boolean enableMotor, float maxMotorTorque, float motorSpeed, float frequencyHz, float dampingRatio)
|
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native boolean | |
| private native int | |
| private native int | |
| private native void | |
| private native void | |
| private native int | |
| private native int | |
| private native boolean | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native long | |
| private void | |
| private void | |
| public void | QueryAABB(QueryCallback
a user implemented callback class. callback, float the x coordinate of the lower left corner lowerX, float the y coordinate of the lower left corner lowerY, float the x coordinate of the upper right corner upperX, float the y coordinate of the upper right corner upperY)Query the world for all fixtures that potentially overlap the provided AABB. |
| public void | rayCast(RayCastCallback
a user implemented callback class. callback, Vector2 the ray starting point point1, Vector2 the ray ending point point2)Ray-cast the world for all fixtures in the path of the ray. |
| public void | rayCast(RayCastCallback
a user implemented callback class. callback, float the ray starting point X point1X, float the ray starting point Y point1Y, float the ray ending point X point2X, float the ray ending point Y point2Y)Ray-cast the world for all fixtures in the path of the ray. |
| private boolean | |
| private float | |
| public void | setAutoClearForces(boolean flag)
Set flag to control automatic clearing of forces after each time step. |
| public void | setContactFilter(ContactFilter filter)
Register a contact filter to provide specific control over collision. |
| public void | |
| public void | |
| public void | |
| public void | |
| private void | setUseDefaultContactFilter(boolean use)
Sets flag to tell the native code not to call the Java World class if use is true |
| public static native void | setVelocityThreshold(float
the threshold, default 1.0f threshold)Sets the box2d velocity threshold globally, for all World instances. |
| public void | |
| public void | step(float
the amount of time to simulate, this should not vary. timeStep, int for the velocity constraint solver. velocityIterations, int for the position constraint solver. positionIterations)Take a time step. |
| addr | back to summary |
|---|---|
| protected final long addr the address of the world instance | |
| bodies | back to summary |
|---|---|
| protected final LongMap<Body> bodies all known bodies | |
| contact | back to summary |
|---|---|
| private final Contact contact | |
| contactAddrs | back to summary |
|---|---|
| private long[] contactAddrs | |
| contactFilter | back to summary |
|---|---|
| protected ContactFilter contactFilter Contact filter | |
| contactListener | back to summary |
|---|---|
| protected ContactListener contactListener Contact listener | |
| contacts | back to summary |
|---|---|
| private final Array<Contact> contacts | |
| fixtures | back to summary |
|---|---|
| protected final LongMap<Fixture> fixtures all known fixtures | |
| freeBodies | back to summary |
|---|---|
| protected final Pool<Body> freeBodies pool for bodies | |
| freeContacts | back to summary |
|---|---|
| private final Array<Contact> freeContacts | |
| freeFixtures | back to summary |
|---|---|
| protected final Pool<Fixture> freeFixtures pool for fixtures | |
| gravity | back to summary |
|---|---|
| pack-priv final Vector2 gravity | |
| impulse | back to summary |
|---|---|
| private final ContactImpulse impulse | |
| joints | back to summary |
|---|---|
| protected final LongMap<Joint> joints all known joints | |
| manifold | back to summary |
|---|---|
| private final Manifold manifold | |
| queryCallback | back to summary |
|---|---|
| private QueryCallback queryCallback | |
| rayCastCallback | back to summary |
|---|---|
| private RayCastCallback rayCastCallback | |
| rayNormal | back to summary |
|---|---|
| private Vector2 rayNormal | |
| rayPoint | back to summary |
|---|---|
| private Vector2 rayPoint | |
| tmpGravity | back to summary |
|---|---|
| pack-priv final float[] tmpGravity Get the global gravity vector. | |
| useDefaultContactFilter | back to summary |
|---|---|
| private boolean useDefaultContactFilter | |
| World | back to summary |
|---|---|
| public World(Vector2 gravity, boolean doSleep) Construct a world object.
| |
| beginContact | back to summary |
|---|---|
| private void beginContact(long contactAddr) | |
| clearForces | back to summary |
|---|---|
| public void clearForces() Manually clear the force buffer on all bodies. By default, forces are cleared automatically after each call to Step. The
default behavior is modified by calling SetAutoClearForces. The purpose of this function is to support sub-stepping.
Sub-stepping is often used to maintain a fixed sized time step under a variable frame-rate. When you perform sub-stepping
you will disable auto clearing of forces and instead call ClearForces after all sub-steps are complete in one pass of your
game loop. | |
| contactFilter | back to summary |
|---|---|
| private boolean contactFilter(long fixtureA, long fixtureB) Internal method called from JNI in case a contact happens
| |
| createBody | back to summary |
|---|---|
| public Body createBody(BodyDef def) Create a rigid body given a definition. No reference to the definition is retained.
Bodies created by this method are pooled internally by the World object.
They will be freed upon calling
| |
| createJoint | back to summary |
|---|---|
| public Joint createJoint(JointDef def) Create a joint to constrain bodies together. No reference to the definition is retained. This may cause the connected bodies to cease colliding. | |
| createProperJoint | back to summary |
|---|---|
| private long createProperJoint(JointDef def) | |
| deactivateBody | back to summary |
|---|---|
| pack-priv void deactivateBody(Body body) Internal method for body deactivation with notifying custom contact listener | |
| destroyBody | back to summary |
|---|---|
| public void destroyBody(Body body) Destroy a rigid body given a definition. No reference to the definition is retained. This function is locked during callbacks. | |
| destroyFixture | back to summary |
|---|---|
| pack-priv void destroyFixture(Body body, Fixture fixture) Internal method for fixture destruction with notifying custom contact listener | |
| destroyJoint | back to summary |
|---|---|
| public void destroyJoint(Joint joint) Destroy a joint. This may cause the connected bodies to begin colliding. | |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Doc from com. Releases all resources of this object. | |
| endContact | back to summary |
|---|---|
| private void endContact(long contactAddr) | |
| getAutoClearForces | back to summary |
|---|---|
| public boolean getAutoClearForces() Get the flag that controls automatic clearing of forces after each time step. | |
| getBodies | back to summary |
|---|---|
| public void getBodies(Array<Body> bodies) | |
| getBodyCount | back to summary |
|---|---|
| public int getBodyCount() Get the number of bodies. | |
| getContactCount | back to summary |
|---|---|
| public int getContactCount() Get the number of contacts (each may have 0 or more contact points). | |
| getContactList | back to summary |
|---|---|
| public Array Returns the list of | |
| getFixtureCount | back to summary |
|---|---|
| public int getFixtureCount() Get the number of fixtures. | |
| getFixtures | back to summary |
|---|---|
| public void getFixtures(Array<Fixture> fixtures) | |
| getGravity | back to summary |
|---|---|
| public Vector2 getGravity() | |
| getJointCount | back to summary |
|---|---|
| public int getJointCount() Get the number of joints. | |
| getJoints | back to summary |
|---|---|
| public void getJoints(Array<Joint> joints) | |
| getProxyCount | back to summary |
|---|---|
| public int getProxyCount() Get the number of broad-phase proxies. | |
| getUseDefaultContactFilter | back to summary |
|---|---|
| private boolean getUseDefaultContactFilter() Internal method called from JNI
| |
| getVelocityThreshold | back to summary |
|---|---|
public static native float getVelocityThreshold()
| |
| isLocked | back to summary |
|---|---|
| public boolean isLocked() Is the world locked (in the middle of a time step). | |
| jniClearForces | back to summary |
|---|---|
| private native void jniClearForces(long addr) | |
| jniCreateBody | back to summary |
|---|---|
| private native long jniCreateBody(long addr, int type, float positionX, float positionY, float angle, float linearVelocityX, float linearVelocityY, float angularVelocity, float linearDamping, float angularDamping, boolean allowSleep, boolean awake, boolean fixedRotation, boolean bullet, boolean active, float inertiaScale) | |
| jniCreateDistanceJoint | back to summary |
|---|---|
| private native long jniCreateDistanceJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float length, float frequencyHz, float dampingRatio) | |
| jniCreateFrictionJoint | back to summary |
|---|---|
| private native long jniCreateFrictionJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float maxForce, float maxTorque) | |
| jniCreateGearJoint | back to summary |
|---|---|
| private native long jniCreateGearJoint(long addr, long bodyA, long bodyB, boolean collideConnected, long joint1, long joint2, float ratio) | |
| jniCreateMotorJoint | back to summary |
|---|---|
| private native long jniCreateMotorJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float linearOffsetX, float linearOffsetY, float angularOffset, float maxForce, float maxTorque, float correctionFactor) | |
| jniCreateMouseJoint | back to summary |
|---|---|
| private native long jniCreateMouseJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float targetX, float targetY, float maxForce, float frequencyHz, float dampingRatio) | |
| jniCreatePrismaticJoint | back to summary |
|---|---|
| private native long jniCreatePrismaticJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float localAxisAX, float localAxisAY, float referenceAngle, boolean enableLimit, float lowerTranslation, float upperTranslation, boolean enableMotor, float maxMotorForce, float motorSpeed) | |
| jniCreatePulleyJoint | back to summary |
|---|---|
| private native long jniCreatePulleyJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float groundAnchorAX, float groundAnchorAY, float groundAnchorBX, float groundAnchorBY, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float lengthA, float lengthB, float ratio) | |
| jniCreateRevoluteJoint | back to summary |
|---|---|
| private native long jniCreateRevoluteJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float referenceAngle, boolean enableLimit, float lowerAngle, float upperAngle, boolean enableMotor, float motorSpeed, float maxMotorTorque) | |
| jniCreateRopeJoint | back to summary |
|---|---|
| private native long jniCreateRopeJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float maxLength) | |
| jniCreateWeldJoint | back to summary |
|---|---|
| private native long jniCreateWeldJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float referenceAngle, float frequencyHz, float dampingRatio) | |
| jniCreateWheelJoint | back to summary |
|---|---|
| private native long jniCreateWheelJoint(long addr, long bodyA, long bodyB, boolean collideConnected, float localAnchorAX, float localAnchorAY, float localAnchorBX, float localAnchorBY, float localAxisAX, float localAxisAY, boolean enableMotor, float maxMotorTorque, float motorSpeed, float frequencyHz, float dampingRatio) | |
| jniDeactivateBody | back to summary |
|---|---|
| private native void jniDeactivateBody(long addr, long bodyAddr) | |
| jniDestroyBody | back to summary |
|---|---|
| private native void jniDestroyBody(long addr, long bodyAddr) | |
| jniDestroyFixture | back to summary |
|---|---|
| private native void jniDestroyFixture(long addr, long bodyAddr, long fixtureAddr) | |
| jniDestroyJoint | back to summary |
|---|---|
| private native void jniDestroyJoint(long addr, long jointAddr) | |
| jniDispose | back to summary |
|---|---|
| private native void jniDispose(long addr) | |
| jniGetAutoClearForces | back to summary |
|---|---|
| private native boolean jniGetAutoClearForces(long addr) | |
| jniGetBodyCount | back to summary |
|---|---|
| private native int jniGetBodyCount(long addr) | |
| jniGetContactCount | back to summary |
|---|---|
| private native int jniGetContactCount(long addr) | |
| jniGetContactList | back to summary |
|---|---|
| private native void jniGetContactList(long addr, long[] contacts) | |
| jniGetGravity | back to summary |
|---|---|
| private native void jniGetGravity(long addr, float[] gravity) | |
| jniGetJointcount | back to summary |
|---|---|
| private native int jniGetJointcount(long addr) | |
| jniGetProxyCount | back to summary |
|---|---|
| private native int jniGetProxyCount(long addr) | |
| jniIsLocked | back to summary |
|---|---|
| private native boolean jniIsLocked(long addr) | |
| jniQueryAABB | back to summary |
|---|---|
| private native void jniQueryAABB(long addr, float lowX, float lowY, float upX, float upY) | |
| jniRayCast | back to summary |
|---|---|
| private native void jniRayCast(long addr, float aX, float aY, float bX, float bY) | |
| jniSetAutoClearForces | back to summary |
|---|---|
| private native void jniSetAutoClearForces(long addr, boolean flag) | |
| jniSetContiousPhysics | back to summary |
|---|---|
| private native void jniSetContiousPhysics(long addr, boolean flag) | |
| jniSetGravity | back to summary |
|---|---|
| private native void jniSetGravity(long addr, float gravityX, float gravityY) | |
| jniSetWarmStarting | back to summary |
|---|---|
| private native void jniSetWarmStarting(long addr, boolean flag) | |
| jniStep | back to summary |
|---|---|
| private native void jniStep(long addr, float timeStep, int velocityIterations, int positionIterations) | |
| newWorld | back to summary |
|---|---|
| private native long newWorld(float gravityX, float gravityY, boolean doSleep) | |
| postSolve | back to summary |
|---|---|
| private void postSolve(long contactAddr, long impulseAddr) | |
| preSolve | back to summary |
|---|---|
| private void preSolve(long contactAddr, long manifoldAddr) | |
| QueryAABB | back to summary |
|---|---|
| public void QueryAABB(QueryCallback callback, float lowerX, float lowerY, float upperX, float upperY) Query the world for all fixtures that potentially overlap the provided AABB.
| |
| rayCast | back to summary |
|---|---|
| public void rayCast(RayCastCallback callback, Vector2 point1, Vector2 point2) Ray-cast the world for all fixtures in the path of the ray. The ray-cast ignores shapes that contain the starting point.
| |
| rayCast | back to summary |
|---|---|
| public void rayCast(RayCastCallback callback, float point1X, float point1Y, float point2X, float point2Y) Ray-cast the world for all fixtures in the path of the ray. The ray-cast ignores shapes that contain the starting point.
| |
| reportFixture | back to summary |
|---|---|
| private boolean reportFixture(long addr) | |
| reportRayFixture | back to summary |
|---|---|
| private float reportRayFixture(long addr, float pX, float pY, float nX, float nY, float fraction) | |
| setAutoClearForces | back to summary |
|---|---|
| public void setAutoClearForces(boolean flag) Set flag to control automatic clearing of forces after each time step. | |
| setContactFilter | back to summary |
|---|---|
| public void setContactFilter(ContactFilter filter) Register a contact filter to provide specific control over collision. Otherwise the default filter is used (b2_defaultFilter). The listener is owned by you and must remain in scope. | |
| setContactListener | back to summary |
|---|---|
| public void setContactListener(ContactListener listener) Register a contact event listener. The listener is owned by you and must remain in scope. | |
| setContinuousPhysics | back to summary |
|---|---|
| public void setContinuousPhysics(boolean flag) Enable/disable continuous physics. For testing. | |
| setDestructionListener | back to summary |
|---|---|
| public void setDestructionListener(DestructionListener listener) Register a destruction listener. The listener is owned by you and must remain in scope. | |
| setGravity | back to summary |
|---|---|
| public void setGravity(Vector2 gravity) Change the global gravity vector. | |
| setUseDefaultContactFilter | back to summary |
|---|---|
| private void setUseDefaultContactFilter(boolean use) Sets flag to tell the native code not to call the Java World class if use is true | |
| setVelocityThreshold | back to summary |
|---|---|
| public static native void setVelocityThreshold(float threshold) Sets the box2d velocity threshold globally, for all World instances.
| |
| setWarmStarting | back to summary |
|---|---|
| public void setWarmStarting(boolean flag) Enable/disable warm starting. For testing. | |
| step | back to summary |
|---|---|
| public void step(float timeStep, int velocityIterations, int positionIterations) Take a time step. This performs collision detection, integration, and constraint solution.
| |