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

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

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.

Construct a world object.
Parameters:
Box2D::b2Vec2 $gravity - the world gravity vector.bool $doSleep - improve performance by not simulating inactive bodies.Returns a Box2D::b2World
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.
Parameters:
Box2D::b2BodyDef $defReturns a Box2D::b2Body
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:
Box2D::b2JointDef $defReturns a Box2D::b2Joint
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:
Box2D::b2Body $bodyGet the global gravity vector.
Returns a Box2D::b2Vec2
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:
Box2D::b2RayCastCallback $callback - a user implemented callback class.Box2D::b2Vec2 $point1 - the ray starting pointBox2D::b2Vec2 $point2 - the ray ending pointRegister a contact event listener. The listener is owned by you and must remain in scope.
Parameters:
Box2D::b2ContactListener $listenerChange the global gravity vector.
Parameters:
Box2D::b2Vec2 $gravityTake a time step. This performs collision detection, integration, and constraint solution.
Parameters:
float32 $timeStep - the amount of time to simulate, this should not vary.int32 $velocityIterations - for the velocity constraint solver.int32 $positionIterations - for the position constraint solver.

See "BUGS" in Box2D

