ackb2d 0.9
3D Gamestudio Box 2d Wraper

b2World.h File Reference

Go to the source code of this file.

Functions

b2Worldb2World_Create (VECTOR *gravity, BOOL doSleep)
void b2World_Destroy (b2World *world)
void b2World_SetDestructionListener (b2World *world, b2DestructionListener *listener)
void b2World_SetContactFilter (b2World *world, b2ContactFilter *filter)
void b2World_SetContactListener (b2World *world, b2ContactListener *listener)
void b2World_SetDebugDraw (b2World *world, b2DebugDraw *debugDraw)
b2Bodyb2World_CreateBody (b2World *world, const b2BodyDef *def)
void b2World_DestroyBody (b2World *world, b2Body *body)
b2Jointb2World_CreateJoint (b2World *world, const b2JointDef *def)
void b2World_DestroyJoint (b2World *world, b2Joint *joint)
void b2World_Step (b2World *world, var timeStep, var velocityIterations, var positionIterations)
void b2World_ClearForces (b2World *world)
void b2World_DrawDebugData (b2World *world)
 Call this to draw shapes and other debug draw data.
void b2World_QueryAABB (b2World *world, b2QueryCallback *callback, const b2AABB *aabb)
void b2World_RayCast (b2World *world, b2RayCastCallback *callback, const VECTOR *point1, const VECTOR *point2)
b2Bodyb2World_GetBodyList (b2World *world)
b2Jointb2World_GetJointList (b2World *world)
b2Contactb2World_GetContactList (b2World *world)
void b2World_SetWarmStarting (b2World *world, var flag)
 Enable/disable warm starting. For testing.
void b2World_SetContinuousPhysics (b2World *world, var flag)
 Enable/disable continuous physics. For testing.
var b2World_GetProxyCount (b2World *world)
 Get the number of broad-phase proxies.
var b2World_GetBodyCount (b2World *world)
 Get the number of bodies.
var b2World_GetJointCount (b2World *world)
 Get the number of joints.
var b2World_GetContactCount (b2World *world)
 Get the number of contacts (each may have 0 or more contact points).
void b2World_SetGravity (b2World *world, const VECTOR *gravity)
 Change the global gravity vector.
void b2World_GetGravity (b2World *world, VECTOR *outGravity)
 Get the global gravity vector.
var b2World_IsLocked (b2World *world)
 Is the world locked (in the middle of a time step).
void b2World_SetAutoClearForces (b2World *world, var flag)
 Set flag to control automatic clearing of forces after each time step.
var b2World_GetAutoClearForces (b2World *world)
 Get the flag that controls automatic clearing of forces after each time step.

Function Documentation

void b2World_ClearForces ( b2World 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. By default, forces will be automatically cleared, so you don't need to call this function.

See also:
SetAutoClearForces
b2World* b2World_Create ( VECTOR *  gravity,
BOOL  doSleep 
)
b2Body* b2World_CreateBody ( b2World world,
const b2BodyDef def 
)

Create a rigid body given a definition. No reference to the definition is retained.

Warning:
This function is locked during callbacks.
b2Joint* b2World_CreateJoint ( b2World world,
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_Destroy ( b2World world)
void b2World_DestroyBody ( b2World world,
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 ( b2World world,
b2Joint joint 
)

Destroy a joint. This may cause the connected bodies to begin colliding.

Warning:
This function is locked during callbacks.
void b2World_DrawDebugData ( b2World world)

Call this to draw shapes and other debug draw data.

var b2World_GetAutoClearForces ( b2World world)

Get the flag that controls automatic clearing of forces after each time step.

var b2World_GetBodyCount ( b2World world)

Get the number of bodies.

b2Body* b2World_GetBodyList ( b2World 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.

Returns:
the head of the world body list.
var b2World_GetContactCount ( b2World world)

Get the number of contacts (each may have 0 or more contact points).

b2Contact* b2World_GetContactList ( b2World world)

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
void b2World_GetGravity ( b2World world,
VECTOR *  outGravity 
)

Get the global gravity vector.

var b2World_GetJointCount ( b2World world)

Get the number of joints.

b2Joint* b2World_GetJointList ( b2World 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.

Returns:
the head of the world joint list.
var b2World_GetProxyCount ( b2World world)

Get the number of broad-phase proxies.

var b2World_IsLocked ( b2World world)

Is the world locked (in the middle of a time step).

void b2World_QueryAABB ( b2World world,
b2QueryCallback callback,
const b2AABB aabb 
)

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

Parameters:
callbacka user implemented callback class.
aabbthe query box.
void b2World_RayCast ( b2World world,
b2RayCastCallback callback,
const VECTOR *  point1,
const VECTOR *  point2 
)

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:
callbacka user implemented callback class.
point1the ray starting point
point2the ray ending point
void b2World_SetAutoClearForces ( b2World world,
var  flag 
)

Set flag to control automatic clearing of forces after each time step.

void b2World_SetContactFilter ( b2World world,
b2ContactFilter 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.

void b2World_SetContactListener ( b2World world,
b2ContactListener listener 
)

Register a contact event listener. The listener is owned by you and must remain in scope.

void b2World_SetContinuousPhysics ( b2World world,
var  flag 
)

Enable/disable continuous physics. For testing.

void b2World_SetDebugDraw ( b2World world,
b2DebugDraw debugDraw 
)

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.

void b2World_SetDestructionListener ( b2World world,
b2DestructionListener listener 
)

Register a destruction listener. The listener is owned by you and must remain in scope.

void b2World_SetGravity ( b2World world,
const VECTOR *  gravity 
)

Change the global gravity vector.

void b2World_SetWarmStarting ( b2World world,
var  flag 
)

Enable/disable warm starting. For testing.

void b2World_Step ( b2World world,
var  timeStep,
var  velocityIterations,
var  positionIterations 
)

Take a time step. This performs collision detection, integration, and constraint solution.

Parameters:
timeStepthe amount of time to simulate, this should not vary.
velocityIterationsfor the velocity constraint solver.
positionIterationsfor the position constraint solver.
 All Data Structures Files Functions Variables Typedefs Defines