Jeffrey T. Palmer > Box2D > Box2D::b2World

Download:
Box2D-0.07.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

Box2D::b2World - Manages all aspects of the simulation.

SYNOPSIS ^

  my $world = Box2D::b2World->new( $gravity, $doSleep );

DESCRIPTION ^

The Box2D::b2World class contains the bodies and joints. It manages all aspects of the simulation and allows for asynchronous queries (like AABB queries and ray-casts). Much of your interactions with Box2D will be with a Box2D::b2World object.

METHODS ^

new( $gravity, $doSleep )

Construct a world object.

Parameters:

Returns a Box2D::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

CreateBody( $def )

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

Warning: This function is locked during callbacks.

Parameters:

Returns a Box2D::b2Body

CreateJoint( $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.

Parameters:

Returns a Box2D::b2Joint

DestroyBody( $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.

Parameters:

GetGravity()

Get the global gravity vector.

Returns a Box2D::b2Vec2

RayCast( $callback, $point1, $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:

SetContactListener( $listener )

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

Parameters:

SetGravity( $gravity )

Change the global gravity vector.

Parameters:

Step( $timeStep, $velocityIterations, $positionIterations )

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

Parameters:

SEE ALSO ^

BUGS ^

See "BUGS" in Box2D

AUTHORS ^

See "AUTHORS" in Box2D

COPYRIGHT & LICENSE ^

See "COPYRIGHT & LICENSE" in Box2D

syntax highlighting: