b2World Class Reference

The world class manages all physics entities, dynamic simulation, and asynchronous queries. More...

List of all members.

Public Member Functions

 b2World (const b2AABB &worldAABB, const b2Vec2 &gravity, bool doSleep)
 Construct a world object.
 ~b2World ()
 Destruct the world. All physics entities are destroyed and all heap memory is released.
void SetListener (b2DestructionListener *listener)
 Register a destruction listener.
void SetListener (b2BoundaryListener *listener)
 Register a broad-phase boundary listener.
void SetFilter (b2ContactFilter *filter)
 Register a contact filter to provide specific control over collision.
void SetListener (b2ContactListener *listener)
 Register a contact event listener.
void SetDebugDraw (b2DebugDraw *debugDraw)
 Register a routine for debug drawing.
b2Body * CreateStaticBody (const b2BodyDef *def)
 Create a static rigid body given a definition.
b2Body * CreateDynamicBody (const b2BodyDef *def)
 Create a dynamic rigid body given a definition.
void DestroyBody (b2Body *body)
 Destroy a rigid body given a definition.
b2Joint * CreateJoint (const b2JointDef *def)
 Create a joint to constrain bodies together.
void DestroyJoint (b2Joint *joint)
 Destroy a joint.
b2Body * GetGroundBody ()
 The world provides a single static ground body with no collision shapes.
void Step (float32 timeStep, int32 iterations)
 Take a time step.
int32 Query (const b2AABB &aabb, b2Shape **shapes, int32 maxCount)
 Query the world for all shapes that potentially overlap the provided AABB.
b2Body * GetBodyList ()
 Get the world body list.
b2Joint * GetJointList ()
 Get the world joint list.


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 b2AABB &  worldAABB,
const b2Vec2 &  gravity,
bool  doSleep 
)

Construct a world object.

Parameters:
worldAABB a bounding box that completely encompasses all your shapes.
gravity the world gravity vector.
doSleep improve performance by not simulating inactive bodies.


Member Function Documentation

void b2World::SetFilter ( b2ContactFilter *  filter  ) 

Register a contact filter to provide specific control over collision.

Otherwise the default filter is used (b2_defaultFilter).

void b2World::SetDebugDraw ( b2DebugDraw *  debugDraw  ) 

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().

b2Body * b2World::CreateStaticBody ( const b2BodyDef *  def  ) 

Create a static rigid body given a definition.

No reference to the definition is retained.

Warning:
This function is locked during callbacks.

b2Body * b2World::CreateDynamicBody ( const b2BodyDef *  def  ) 

Create a dynamic rigid body given a definition.

No reference to the definition is retained.

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.

b2Joint * b2World::CreateJoint ( const b2JointDef *  def  ) 

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::DestroyJoint ( b2Joint *  joint  ) 

Destroy a joint.

This may cause the connected bodies to begin colliding.

Warning:
This function is locked during callbacks.

b2Body * b2World::GetGroundBody (  )  [inline]

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.

void b2World::Step ( float32  timeStep,
int32  iterations 
)

Take a time step.

This performs collision detection, integration, and constraint solution.

Parameters:
timeStep the amount of time to simulate, this should not vary.
iterations the number of iterations to be used by the constraint solver.

int32 b2World::Query ( const b2AABB &  aabb,
b2Shape **  shapes,
int32  maxCount 
)

Query the world for all shapes that potentially overlap the provided AABB.

You provide a shape pointer buffer of specified size. The number of shapes found is returned.

Parameters:
aabb the query box.
shapes a user allocated shape pointer array of size maxCount (or greater).
maxCount the capacity of the shapes array.
Returns:
the number of shapes found in aabb.

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.

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.


The documentation for this class was generated from the following files:
Generated on Fri Mar 7 23:58:18 2008 for Box2D by  doxygen 1.5.4