b2World Class Reference
#include <b2World.h>
List of all members.
Detailed Description
The world class manages all physics entities, dynamic simulation, and asynchronous queries. The world also contains efficient memory management facilities.
Constructor & Destructor Documentation
b2World::b2World |
( |
const b2Vec2 & |
gravity, |
|
|
bool |
doSleep | |
|
) |
| | |
Construct a world object.
- Parameters:
-
| gravity | the world gravity vector. |
| doSleep | improve performance by not simulating inactive bodies. |
Destruct the world. All physics entities are destroyed and all heap memory is released.
Member Function Documentation
void b2World::ClearForces |
( |
|
) |
|
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. By default, forces will be automatically cleared, so you don't need to call this function.
- See also:
- SetAutoClearForces
Create a rigid body given a definition. No reference to the definition is retained.
- Warning:
- This function is locked during callbacks.
Create a joint to constrain bodies together. No reference to the definition is retained. This may cause the connected bodies to cease colliding.
- Warning:
- This function is locked during callbacks.
void b2World::DestroyBody |
( |
b2Body * |
body |
) |
|
Destroy a rigid body given a definition. No reference to the definition is retained. This function is locked during callbacks.
- Warning:
- This automatically deletes all associated shapes and joints.
-
This function is locked during callbacks.
void b2World::DestroyJoint |
( |
b2Joint * |
joint |
) |
|
Destroy a joint. This may cause the connected bodies to begin colliding.
- Warning:
- This function is locked during callbacks.
void b2World::DrawDebugData |
( |
|
) |
|
Call this to draw shapes and other debug draw data.
bool b2World::GetAutoClearForces |
( |
|
) |
const [inline] |
Get the flag that controls automatic clearing of forces after each time step.
int32 b2World::GetBodyCount |
( |
|
) |
const [inline] |
Get the number of bodies.
b2Body * b2World::GetBodyList |
( |
|
) |
[inline] |
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.
- Returns:
- the head of the world body list.
int32 b2World::GetContactCount |
( |
|
) |
const [inline] |
Get the number of contacts (each may have 0 or more contact points).
b2Contact * b2World::GetContactList |
( |
|
) |
[inline] |
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.
- Returns:
- the head of the world contact list.
- Warning:
- contacts are
b2Vec2 b2World::GetGravity |
( |
|
) |
const [inline] |
Get the global gravity vector.
int32 b2World::GetJointCount |
( |
|
) |
const [inline] |
Get the number of joints.
b2Joint * b2World::GetJointList |
( |
|
) |
[inline] |
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.
- Returns:
- the head of the world joint list.
int32 b2World::GetProxyCount |
( |
|
) |
const |
Get the number of broad-phase proxies.
bool b2World::IsLocked |
( |
|
) |
const [inline] |
Is the world locked (in the middle of a time step).
Query the world for all fixtures that potentially overlap the provided AABB.
- Parameters:
-
| callback | a user implemented callback class. |
| aabb | the query box. |
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.
- Parameters:
-
| callback | a user implemented callback class. |
| point1 | the ray starting point |
| point2 | the ray ending point |
void b2World::SetAutoClearForces |
( |
bool |
flag |
) |
[inline] |
Set flag to control automatic clearing of forces after each time step.
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.
Register a contact event listener. The listener is owned by you and must remain in scope.
void b2World::SetContinuousPhysics |
( |
bool |
flag |
) |
[inline] |
Enable/disable continuous physics. For testing.
Register a routine for debug drawing. The debug draw functions are called inside with b2World::DrawDebugData method. The debug draw object is owned by you and must remain in scope.
Register a destruction listener. The listener is owned by you and must remain in scope.
void b2World::SetGravity |
( |
const b2Vec2 & |
gravity |
) |
[inline] |
Change the global gravity vector.
void b2World::SetWarmStarting |
( |
bool |
flag |
) |
[inline] |
Enable/disable warm starting. For testing.
void b2World::Step |
( |
float32 |
timeStep, |
|
|
int32 |
velocityIterations, |
|
|
int32 |
positionIterations | |
|
) |
| | |
Take a time step. This performs collision detection, integration, and constraint solution.
- Parameters:
-
| timeStep | the amount of time to simulate, this should not vary. |
| velocityIterations | for the velocity constraint solver. |
| positionIterations | for the position constraint solver. |
Friends And Related Function Documentation
friend class b2Controller [friend] |
The documentation for this class was generated from the following files: