The world class manages all physics entities, dynamic simulation, and asynchronous queries.
Creates a new world.
The world gravity vector.
Improvie performance by not simulating inactive bodies.
Locked
New Fixture
Add a controller to the world list.
Controller to add.
Controller that was added to the world.
Call this after you are done with time steps to clear the forces. You normally call this after each call to Step, unless you are performing sub-steps.
Create a rigid body given a definition. No reference to the definition is retained.
Body's definition.
Created rigid body.
Creates a new controller.
New controller.
New controller.
Create a joint to constrain bodies together. No reference to the definition is retained. This may cause the connected bodies to cease colliding.
Joint definition.
New created joint.
Destroy a rigid body given a definition. No reference to the definition is retained. This function is locked during callbacks.
Body to destroy.
Destroy a controller given the controller instance.
Controller to destroy.
Destroy a joint. This may cause the connected bodies to begin colliding.
Joint to destroy.
Call this to draw shapes and other debug draw data.
Get the number of bodies.
number
Number of bodies in this world.
Get the world body list. With the returned body, use b2Body::GetNext to get the next body in the world list. A NULL body indicates the end of the list.
The head of the world body list.
Get the number of contacts (each may have 0 or more contact points).
number
Number of contacts.
Get the world contact list. With the returned contact, use b2Contact::GetNext to get the next contact in the world list. A NULL contact indicates the end of the list.
The head of the world contact list.
Get the global gravity vector.
Global gravity vector.
The world provides a single static ground body with no collision shapes. You can use this to simplify the creation of joints and static shapes.
The ground body.
Get the number of joints.
number
The number of joints in the world.
Get the world joint list. With the returned joint, use b2Joint::GetNext to get the next joint in the world list. A NULL joint indicates the end of the list.
The head of the world joint list.
Get the number of broad-phase proxies.
number
Number of borad-phase proxies.
Is the world locked (in the middle of a time step).
boolean
True if the world is locked and in the middle of a time step, otherwise false.
Query the world for all fixtures that potentially overlap the provided AABB.
A user implemented callback class. It should match signature function Callback(fixture:b2Fixture):Boolean. Return true to continue to the next fixture.
The query bounding box.
Query the world for all fixtures that contain a point.
A user implemented callback class. It should match signature function Callback(fixture:b2Fixture):Boolean. Return true to continue to the next fixture.
The query point.
Query the world for all fixtures that precisely overlap the provided transformed shape.
A user implemented callback class. It should match signature function Callback(fixture:b2Fixture):Boolean. Return true to continue to the next fixture.
The query shape.
Optional transform, default = null.
Ray-cast the world for all fixtures in the path of the ray. Your callback Controls whether you get the closest point, any point, or n-points The ray-cast ignores shapes that contain the starting point.
A callback function which must be of signature: function Callback( fixture:b2Fixture, // The fixture hit by the ray point:b2Vec2, // The point of initial intersection normal:b2Vec2, // The normal vector at the point of intersection fraction:Number // The fractional length along the ray of the intersection ):Number Callback should return the new length of the ray as a fraction of the original length. By returning 0, you immediately terminate. By returning 1, you continue wiht the original ray. By returning the current fraction, you proceed to find the closest point.
The ray starting point.
The ray ending point.
Ray-cast the world for all fixture in the path of the ray.
Array of all the fixtures intersected by the ray.
Ray-cast the world for the first fixture in the path of the ray.
First fixture intersected by the ray.
Removes the controller from the world.
Controller to remove.
Use the given object as a broadphase. The old broadphase will not be cleanly emptied.
Register a contact filter to provide specific control over collision. Otherwise the default filter is used (b2_defaultFilter).
Contact filter'er.
Register a contact event listener.
Contact event listener.
Enable/disable continuous physics. For testing.
True for continuous physics, otherwise false.
Register a routine for debug drawing. The debug draw functions are called inside the b2World::Step method, so make sure your renderer is ready to consume draw commands when you call Step().
Debug drawing instance.
Destruct the world. All physics entities are destroyed and all heap memory is released.
Destruction listener instance.
Change the global gravity vector.
New global gravity vector.
Enable/disable warm starting. For testing.
True for warm starting, otherwise false.
Take a time step. This performs collision detection, integration, and constraint solution.
The amout of time to simulate, this should not vary.
For the velocity constraint solver.
For the position constraint solver.
Perform validation of internal data structures.