PackageBox2D.Dynamics
Classpublic class b2World



Public Methods
 MethodDefined by
  
b2World(worldAABB:b2AABB, gravity:b2Vec2, doSleep:Boolean)
Construct a world object.
b2World
  
Create a rigid body given a definition.
b2World
  
Create a joint to constrain bodies together.
b2World
  
Destroy a rigid body given a definition.
b2World
  
Destroy a joint.
b2World
  
b2World
  
DrawJoint(joint:b2Joint):void
b2World
  
DrawShape(shape:b2Shape, xf:b2XForm, color:b2Color, core:Boolean):void
b2World
  
Get the number of bodies.
b2World
  
Get the world body list.
b2World
  
Get the number of contacts (each may have 0 or more contact points).
b2World
  
Get the global gravity vector.
b2World
  
The world provides a single static ground body with no collision shapes.
b2World
  
Get the number of joints.
b2World
  
Get the world joint list.
b2World
  
Get the number of broad-phase pairs.
b2World
  
Get the number of broad-phase proxies.
b2World
  
InRange(aabb:b2AABB):Boolean
Check if the AABB is within the broadphase limits.
b2World
  
Query(aabb:b2AABB, shapes:Array, maxCount:int):int
Query the world for all shapes that potentially overlap the provided AABB.
b2World
  
Refilter(shape:b2Shape):void
Re-filter a shape.
b2World
  
Register a broad-phase boundary listener.
b2World
  
Register a contact filter to provide specific control over collision.
b2World
  
Register a contact event listener
b2World
  
SetContinuousPhysics(flag:Boolean):void
Enable/disable continuous physics.
b2World
  
SetDebugDraw(debugDraw:b2DebugDraw):void
Register a routine for debug drawing.
b2World
  
Destruct the world.
b2World
  
SetGravity(gravity:b2Vec2):void
Change the global gravity vector.
b2World
  
SetPositionCorrection(flag:Boolean):void
Enable/disable position correction.
b2World
  
SetWarmStarting(flag:Boolean):void
Enable/disable warm starting.
b2World
  
Solve(step:b2TimeStep):void
b2World
  
SolveTOI(step:b2TimeStep):void
b2World
  
Step(dt:Number, iterations:int):void
Take a time step.
b2World
  
Validate():void
Perform validation of internal data structures.
b2World
Property detail
m_blockAllocatorproperty
b2internal var m_blockAllocator:*
m_bodyListproperty 
b2internal var m_bodyList:b2Body
m_broadPhaseproperty 
b2internal var m_broadPhase:b2BroadPhase
m_contactCountproperty 
b2internal var m_contactCount:int
m_contactFilterproperty 
b2internal var m_contactFilter:b2ContactFilter
m_contactListproperty 
b2internal var m_contactList:b2Contact
m_contactListenerproperty 
b2internal var m_contactListener:b2ContactListener
m_groundBodyproperty 
b2internal var m_groundBody:b2Body
m_lockproperty 
b2internal var m_lock:Boolean
m_stackAllocatorproperty 
b2internal var m_stackAllocator:*
Constructor detail
b2World()constructor
public function b2World(worldAABB:b2AABB, gravity:b2Vec2, doSleep:Boolean)

Construct a world object.

Parameters
worldAABB:b2AABB — a bounding box that completely encompasses all your shapes.
 
gravity:b2Vec2 — the world gravity vector.
 
doSleep:Boolean — improve performance by not simulating inactive bodies.
Method detail
CreateBody()method
public function CreateBody(def:b2BodyDef):b2Body

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

Parameters
def:b2BodyDef

Returns
b2Body
CreateJoint()method 
public function CreateJoint(def:b2JointDef):b2Joint

Create a joint to constrain bodies together. No reference to the definition is retained. This may cause the connected bodies to cease colliding.

Parameters
def:b2JointDef

Returns
b2Joint
DestroyBody()method 
public function DestroyBody(b:b2Body):void

Destroy a rigid body given a definition. No reference to the definition is retained. This function is locked during callbacks.

Parameters
b:b2Body
DestroyJoint()method 
public function DestroyJoint(j:b2Joint):void

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

Parameters
j:b2Joint
DrawDebugData()method 
public function DrawDebugData():void
DrawJoint()method 
public function DrawJoint(joint:b2Joint):voidParameters
joint:b2Joint
DrawShape()method 
public function DrawShape(shape:b2Shape, xf:b2XForm, color:b2Color, core:Boolean):voidParameters
shape:b2Shape
 
xf:b2XForm
 
color:b2Color
 
core:Boolean
GetBodyCount()method 
public function GetBodyCount():int

Get the number of bodies.

Returns
int
GetBodyList()method 
public function GetBodyList():b2Body

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
b2Body — the head of the world body list.
GetContactCount()method 
public function GetContactCount():int

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

Returns
int
GetGravity()method 
public function GetGravity():b2Vec2

Get the global gravity vector.

Returns
b2Vec2
GetGroundBody()method 
public function GetGroundBody():b2Body

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.

Returns
b2Body
GetJointCount()method 
public function GetJointCount():int

Get the number of joints.

Returns
int
GetJointList()method 
public function GetJointList():b2Joint

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
b2Joint — the head of the world joint list.
GetPairCount()method 
public function GetPairCount():int

Get the number of broad-phase pairs.

Returns
int
GetProxyCount()method 
public function GetProxyCount():int

Get the number of broad-phase proxies.

Returns
int
InRange()method 
public function InRange(aabb:b2AABB):Boolean

Check if the AABB is within the broadphase limits.

Parameters
aabb:b2AABB

Returns
Boolean
Query()method 
public function Query(aabb:b2AABB, shapes:Array, maxCount:int):int

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:b2AABB — the query box.
 
shapes:Array — a user allocated shape pointer array of size maxCount (or greater).
 
maxCount:int — the capacity of the shapes array.

Returns
int — the number of shapes found in aabb.
Refilter()method 
public function Refilter(shape:b2Shape):void

Re-filter a shape. This re-runs contact filtering on a shape.

Parameters
shape:b2Shape
SetBoundaryListener()method 
public function SetBoundaryListener(listener:b2BoundaryListener):void

Register a broad-phase boundary listener.

Parameters
listener:b2BoundaryListener
SetContactFilter()method 
public function SetContactFilter(filter:b2ContactFilter):void

Register a contact filter to provide specific control over collision. Otherwise the default filter is used (b2_defaultFilter).

Parameters
filter:b2ContactFilter
SetContactListener()method 
public function SetContactListener(listener:b2ContactListener):void

Register a contact event listener

Parameters
listener:b2ContactListener
SetContinuousPhysics()method 
public function SetContinuousPhysics(flag:Boolean):void

Enable/disable continuous physics. For testing.

Parameters
flag:Boolean
SetDebugDraw()method 
public function SetDebugDraw(debugDraw:b2DebugDraw):void

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

Parameters
debugDraw:b2DebugDraw
SetDestructionListener()method 
public function SetDestructionListener(listener:b2DestructionListener):void

Destruct the world. All physics entities are destroyed and all heap memory is released. ~b2World(); Register a destruction listener.

Parameters
listener:b2DestructionListener
SetGravity()method 
public function SetGravity(gravity:b2Vec2):void

Change the global gravity vector.

Parameters
gravity:b2Vec2
SetPositionCorrection()method 
public function SetPositionCorrection(flag:Boolean):void

Enable/disable position correction. For testing.

Parameters
flag:Boolean
SetWarmStarting()method 
public function SetWarmStarting(flag:Boolean):void

Enable/disable warm starting. For testing.

Parameters
flag:Boolean
Solve()method 
public function Solve(step:b2TimeStep):voidParameters
step:b2TimeStep
SolveTOI()method 
public function SolveTOI(step:b2TimeStep):voidParameters
step:b2TimeStep
Step()method 
public function Step(dt:Number, iterations:int):void

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

Parameters
dt:Number — the amount of time to simulate, this should not vary.
 
iterations:int — the number of iterations to be used by the constraint solver.
Validate()method 
public function Validate():void

Perform validation of internal data structures.