| Package | Box2D.Dynamics |
| Class | public class b2World |
| Source | b2World.as |
| Method | Defined by | ||
|---|---|---|---|
|
| b2World | ||
|
Add a controller to the world list
| b2World | ||
|
ClearForces():void
Call this after you are done with time steps to clear the forces.
| b2World | ||
|
Create a rigid body given a definition.
| b2World | ||
| b2World | |||
|
Create a joint to constrain bodies together.
| b2World | ||
|
DestroyBody(b:b2Body):void
Destroy a rigid body given a definition.
| b2World | ||
|
DestroyController(controller:b2Controller):void
| b2World | ||
|
DestroyJoint(j:b2Joint):void
Destroy a joint.
| b2World | ||
|
DrawDebugData():void
Call this to draw shapes and other debug draw data.
| b2World | ||
|
GetBodyCount():int
Get the number of bodies.
| b2World | ||
|
Get the world body list.
| b2World | ||
|
GetContactCount():int
Get the number of contacts (each may have 0 or more contact points).
| b2World | ||
|
Get the world contact list.
| b2World | ||
|
Get the global gravity vector.
| b2World | ||
|
The world provides a single static ground body with no collision shapes.
| b2World | ||
|
GetJointCount():int
Get the number of joints.
| b2World | ||
|
Get the world joint list.
| b2World | ||
|
GetProxyCount():int
Get the number of broad-phase proxies.
| b2World | ||
|
IsLocked():Boolean
Is the world locked (in the middle of a time step).
| b2World | ||
|
Query the world for all fixtures that potentially overlap the
provided AABB.
| b2World | ||
|
QueryPoint(callback:Function, p:b2Vec2):void
Query the world for all fixtures that contain a point.
| b2World | ||
|
Query the world for all fixtures that precisely overlap the
provided transformed shape.
| b2World | ||
|
Ray-cast the world for all fixtures in the path of the ray.
| b2World | ||
| b2World | |||
| b2World | |||
|
RemoveController(c:b2Controller):void
| b2World | ||
|
SetBroadPhase(broadPhase:IBroadPhase):void
Use the given object as a broadphase.
| b2World | ||
|
SetContactFilter(filter:b2ContactFilter):void
Register a contact filter to provide specific control over collision.
| b2World | ||
|
SetContactListener(listener:b2ContactListener):void
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 | ||
|
SetDestructionListener(listener:b2DestructionListener):void
Destruct the world.
| b2World | ||
|
SetGravity(gravity:b2Vec2):void
Change the global gravity vector.
| b2World | ||
|
SetWarmStarting(flag:Boolean):void
Enable/disable warm starting.
| b2World | ||
|
Step(dt:Number, velocityIterations:int, positionIterations:int):void
Take a time step.
| b2World | ||
|
Validate():void
Perform validation of internal data structures.
| b2World | ||
| Constant | Defined by | ||
|---|---|---|---|
| e_locked : int = 0x0002 [static]
| b2World | ||
| e_newFixture : int = 0x0001 [static]
| b2World | ||
| b2World | () | constructor |
public function b2World(gravity:b2Vec2, doSleep:Boolean)Parameters
gravity:b2Vec2 — the world gravity vector.
|
|
doSleep:Boolean — improve performance by not simulating inactive bodies.
|
| AddController | () | method |
public function AddController(c:b2Controller):b2ControllerAdd a controller to the world list
Parametersc:b2Controller |
b2Controller |
| ClearForces | () | method |
public function ClearForces():voidCall 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.
| CreateBody | () | method |
public function CreateBody(def:b2BodyDef):b2BodyCreate a rigid body given a definition. No reference to the definition is retained.
Warning: This function is locked during callbacks.
Parametersdef:b2BodyDef |
b2Body |
| CreateController | () | method |
public function CreateController(controller:b2Controller):b2ControllerParameters
controller:b2Controller |
b2Controller |
| CreateJoint | () | method |
public function CreateJoint(def:b2JointDef):b2JointCreate 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.
Parametersdef:b2JointDef |
b2Joint |
| DestroyBody | () | method |
public function DestroyBody(b:b2Body):voidDestroy a rigid body given a definition. No reference to the definition is retained. This function is locked during callbacks.
Warning: This function is locked during callbacks.
Parametersb:b2Body |
| DestroyController | () | method |
| DestroyJoint | () | method |
public function DestroyJoint(j:b2Joint):voidDestroy a joint. This may cause the connected bodies to begin colliding.
Warning: This function is locked during callbacks.
Parametersj:b2Joint |
| DrawDebugData | () | method |
public function DrawDebugData():voidCall this to draw shapes and other debug draw data.
| GetBodyCount | () | method |
public function GetBodyCount():intGet the number of bodies.
Returnsint |
| GetBodyList | () | method |
public function GetBodyList():b2BodyGet 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.
Returnsb2Body —
the head of the world body list.
|
| GetContactCount | () | method |
public function GetContactCount():intGet the number of contacts (each may have 0 or more contact points).
Returnsint |
| GetContactList | () | method |
public function GetContactList():b2ContactGet 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.
Warning: contacts are
Returnsb2Contact —
the head of the world contact list.
|
| GetGravity | () | method |
| GetGroundBody | () | method |
public function GetGroundBody():b2BodyThe world provides a single static ground body with no collision shapes. You can use this to simplify the creation of joints and static shapes.
Returnsb2Body |
| GetJointCount | () | method |
public function GetJointCount():intGet the number of joints.
Returnsint |
| GetJointList | () | method |
public function GetJointList():b2JointGet 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.
Returnsb2Joint —
the head of the world joint list.
|
| GetProxyCount | () | method |
public function GetProxyCount():intGet the number of broad-phase proxies.
Returnsint |
| IsLocked | () | method |
public function IsLocked():BooleanIs the world locked (in the middle of a time step).
ReturnsBoolean |
| QueryAABB | () | method |
public function QueryAABB(callback:Function, aabb:b2AABB):voidQuery the world for all fixtures that potentially overlap the provided AABB.
Parameterscallback:Function — a user implemented callback class. It should match signature
function Callback(fixture:b2Fixture):Boolean
Return true to continue to the next fixture.
|
|
aabb:b2AABB — the query box.
|
| QueryPoint | () | method |
public function QueryPoint(callback:Function, p:b2Vec2):voidQuery the world for all fixtures that contain a point.
Note: This provides a feature specific to this port.
Parameterscallback:Function — a user implemented callback class. It should match signature
function Callback(fixture:b2Fixture):Boolean
Return true to continue to the next fixture.
|
|
p:b2Vec2 |
| QueryShape | () | method |
public function QueryShape(callback:Function, shape:b2Shape, transform:b2Transform = null):voidQuery the world for all fixtures that precisely overlap the provided transformed shape.
Note: This provides a feature specific to this port.
Parameterscallback:Function — a user implemented callback class. It should match signature
function Callback(fixture:b2Fixture):Boolean
Return true to continue to the next fixture.
|
|
shape:b2Shape |
|
transform:b2Transform (default = null) |
| RayCast | () | method |
public function RayCast(callback:Function, point1:b2Vec2, point2:b2Vec2):voidRay-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
Parameterscallback:Function — A callback function which must be of signature:
function Callback(fixture:b2Fixture, // The fixture hit by the ray
point:b2Vec2, // The point of initial intersection
normal:b2Vec2, // The normal vector at the point of intersection
fraction:Number // The fractional length along the ray of the intersection
):Number
Callback should return the new length of the ray as a fraction of the original length.
By returning 0, you immediately terminate.
By returning 1, you continue wiht the original ray.
By returning the current fraction, you proceed to find the closest point.
|
|
point1:b2Vec2 — the ray starting point
|
|
point2:b2Vec2 — the ray ending point
|
| RayCastAll | () | method |
public function RayCastAll(point1:b2Vec2, point2:b2Vec2):VectorParameters
point1:b2Vec2 |
|
point2:b2Vec2 |
Vector |
| RayCastOne | () | method |
public function RayCastOne(point1:b2Vec2, point2:b2Vec2):b2FixtureParameters
point1:b2Vec2 |
|
point2:b2Vec2 |
b2Fixture |
| RemoveController | () | method |
| SetBroadPhase | () | method |
public function SetBroadPhase(broadPhase:IBroadPhase):voidUse the given object as a broadphase. The old broadphase will not be cleanly emptied.
Warning: This function is locked during callbacks.
ParametersbroadPhase:IBroadPhase |
| SetContactFilter | () | method |
public function SetContactFilter(filter:b2ContactFilter):voidRegister a contact filter to provide specific control over collision. Otherwise the default filter is used (b2_defaultFilter).
Parametersfilter:b2ContactFilter |
| SetContactListener | () | method |
public function SetContactListener(listener:b2ContactListener):voidRegister a contact event listener
Parameterslistener:b2ContactListener |
| SetContinuousPhysics | () | method |
public function SetContinuousPhysics(flag:Boolean):voidEnable/disable continuous physics. For testing.
Parametersflag:Boolean |
| SetDebugDraw | () | method |
public function SetDebugDraw(debugDraw:b2DebugDraw):voidRegister 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().
ParametersdebugDraw:b2DebugDraw |
| SetDestructionListener | () | method |
public function SetDestructionListener(listener:b2DestructionListener):voidDestruct the world. All physics entities are destroyed and all heap memory is released.
Parameterslistener:b2DestructionListener |
| SetGravity | () | method |
public function SetGravity(gravity:b2Vec2):voidChange the global gravity vector.
Parametersgravity:b2Vec2 |
| SetWarmStarting | () | method |
public function SetWarmStarting(flag:Boolean):voidEnable/disable warm starting. For testing.
Parametersflag:Boolean |
| Step | () | method |
public function Step(dt:Number, velocityIterations:int, positionIterations:int):voidTake a time step. This performs collision detection, integration, and constraint solution.
Parametersdt:Number — the amount of time to simulate, this should not vary.
|
|
velocityIterations:int — for the velocity constraint solver.
|
|
positionIterations:int — for the position constraint solver.
|
| Validate | () | method |
public function Validate():voidPerform validation of internal data structures.
| e_locked | constant |
public static const e_locked:int = 0x0002
| e_newFixture | constant |
public static const e_newFixture:int = 0x0001