The physics simulation world. This manages entire the dynamic simulation. You can add rigid bodies and joints to the world to simulate them.

Constructor

@:value({ gravity : null, broadPhaseType : BroadPhaseType._BVH })new(broadPhaseType:Int = BroadPhaseType._BVH, ?gravity:Vec3)

Creates a new physics world, with broad-phase collision detection algorithm broadPhaseType and gravitational acceleration gravity.

Methods

aabbTest(aabb:Aabb, callback:AabbTestCallback):Void

Performs an AABB query. callback.process is called for all shapes that their AABB and aabb intersect.

addJoint(joint:Joint):Void

Adds the joint joint to the simulation world.

addRigidBody(rigidBody:RigidBody):Void

Adds the rigid body rigidBody to the simulation world.

convexCast(convex:ConvexGeometry, begin:Transform, translation:Vec3, callback:RayCastCallback):Void

Performs a convex casting. callback.process is called for all shapes the convex geometry convex hits. The convex geometry translates by translation starting from the beginning transform begin.

debugDraw():Void

Draws the simulation world for debugging. Call World.setDebugDraw to set the debug draw interface.

inlinegetBroadPhase():BroadPhase

Returns the broad-phase collision detection algorithm.

inlinegetContactManager():ContactManager

Returns the contact manager.

inlinegetDebugDraw():DebugDraw

Returns the debug draw interface.

inlinegetGravity():Vec3

Returns the gravitational acceleration of the simulation world.

inlinegetJointList():Joint

Returns the list of the joints added to the world.

inlinegetNumIslands():Int

Returns the number of simulation islands.

inlinegetNumJoints():Int

Returns the number of the joints added to the world.

inlinegetNumPositionIterations():Int

Returns the number of position iterations of constraint solvers.

inlinegetNumRigidBodies():Int

Returns the number of the rigid bodies added to the world.

inlinegetNumShapes():Int

Returns the number of the shapes added to the world.

inlinegetNumVelocityIterations():Int

Returns the number of velocity iterations of constraint solvers.

inlinegetRigidBodyList():RigidBody

Returns the list of the rigid bodies added to the world.

rayCast(begin:Vec3, end:Vec3, callback:RayCastCallback):Void

Performs a ray casting. callback.process is called for all shapes the ray from begin to end hits.

removeJoint(joint:Joint):Void

Removes the joint joint from the simulation world.

removeRigidBody(rigidBody:RigidBody):Void

Removes the rigid body rigidBody from the simulation world.

inlinesetDebugDraw(debugDraw:DebugDraw):Void

Sets the debug draw interface to debugDraw. Call World.debugDraw to draw the simulation world.

inlinesetGravity(gravity:Vec3):Void

Sets the gravitational acceleration of the simulation world to gravity.

inlinesetNumPositionIterations(numPositionIterations:Int):Void

Sets the number of position iterations of constraint solvers to numPositionIterations.

inlinesetNumVelocityIterations(numVelocityIterations:Int):Void

Sets the number of velocity iterations of constraint solvers to numVelocityIterations.

step(timeStep:Float):Void

Advances the simulation by the time step timeStep.