C# Class Box2DX.Dynamics.World

The world class manages all physics entities, dynamic simulation, and asynchronous queries.
Inheritance: IDisposable
Afficher le fichier Open project: danielpcox/Crisis-at-Swiss-Station Class Usage Examples

Méthodes publiques

Méthode Description
AddController ( Controllers def ) : Controller
CreateBody ( BodyDef def ) : Body

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

CreateJoint ( JointDef def ) : Joint

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.

DestroyBody ( Body b ) : void

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. @warning This function is locked during callbacks.

DestroyJoint ( Joint j ) : void

Destroy a joint. This may cause the connected bodies to begin colliding. @warning This function is locked during callbacks.

Dispose ( ) : void

Destruct the world. All physics entities are destroyed.

GetBodyCount ( ) : int

Get the number of bodies.

GetBodyList ( ) : Body

Get the world body list. With the returned body, use Body.GetNext to get the next body in the world list. A null body indicates the end of the list.

GetContactCount ( ) : int

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

GetGroundBody ( ) : Body

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.

GetJointCount ( ) : int

Get the number joints.

GetJointList ( ) : Joint

Get the world joint list. With the returned joint, use Joint.GetNext to get the next joint in the world list. A null joint indicates the end of the list.

GetPairCount ( ) : int

Get the number of broad-phase pairs.

GetProxyCount ( ) : int

Get the number of broad-phase proxies.

InRange ( AABB aabb ) : bool
Query ( AABB aabb, Shape shapes, int maxCount ) : int
Raycast ( Segment segment, Shape shapes, int maxCount, bool solidShapes, object userData ) : int

Query the world for all shapes that intersect a given segment. You provide a shap pointer buffer of specified size. The number of shapes found is returned, and the buffer is filled in order of intersection.

RaycastOne ( Segment segment, float &lambda, Vec2 &normal, bool solidShapes, object userData ) : Shape

Performs a raycast as with Raycast, finding the first intersecting shape.

Refilter ( Shape shape ) : void

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

RemoveController ( Controllers controller ) : void
SetBoundaryListener ( BoundaryListener listener ) : void

Register a broad-phase boundary listener.

SetContactFilter ( ContactFilter filter ) : void

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

SetContactListener ( ContactListener listener ) : void

Register a contact event listener

SetContinuousPhysics ( bool flag ) : void

Enable/disable continuous physics. For testing.

SetDebugDraw ( DebugDraw debugDraw ) : void

Register a routine for debug drawing. The debug draw functions are called inside the World.Step method, so make sure your renderer is ready to consume draw commands when you call Step().

SetDestructionListener ( DestructionListener listener ) : void

Register a destruction listener.

SetWarmStarting ( bool flag ) : void

Enable/disable warm starting. For testing.

Step ( float dt, int velocityIterations, int positionIteration ) : void

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

Validate ( ) : void

Perform validation of internal data structures.

World ( AABB worldAABB, Vec2 gravity, bool doSleep ) : System

Construct a world object.

Private Methods

Méthode Description
DrawDebugData ( ) : void
DrawJoint ( Joint joint ) : void
DrawShape ( Shape shape, XForm xf, Color color, bool core ) : void
RaycastSortKey ( object data ) : float
Solve ( TimeStep step ) : void
SolveTOI ( TimeStep step ) : void

Method Details

AddController() public méthode

public AddController ( Controllers def ) : Controller
def Controllers
Résultat Box2DX.Dynamics.Controllers.Controller

CreateBody() public méthode

Create a rigid body given a definition. No reference to the definition is retained. @warning This function is locked during callbacks.
public CreateBody ( BodyDef def ) : Body
def BodyDef
Résultat Body

CreateJoint() public méthode

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.
public CreateJoint ( JointDef def ) : Joint
def JointDef
Résultat Joint

DestroyBody() public méthode

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. @warning This function is locked during callbacks.
public DestroyBody ( Body b ) : void
b Body
Résultat void

DestroyJoint() public méthode

Destroy a joint. This may cause the connected bodies to begin colliding. @warning This function is locked during callbacks.
public DestroyJoint ( Joint j ) : void
j Joint
Résultat void

Dispose() public méthode

Destruct the world. All physics entities are destroyed.
public Dispose ( ) : void
Résultat void

GetBodyCount() public méthode

Get the number of bodies.
public GetBodyCount ( ) : int
Résultat int

GetBodyList() public méthode

Get the world body list. With the returned body, use Body.GetNext to get the next body in the world list. A null body indicates the end of the list.
public GetBodyList ( ) : Body
Résultat Body

GetContactCount() public méthode

Get the number of contacts (each may have 0 or more contact points).
public GetContactCount ( ) : int
Résultat int

GetGroundBody() public méthode

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.
public GetGroundBody ( ) : Body
Résultat Body

GetJointCount() public méthode

Get the number joints.
public GetJointCount ( ) : int
Résultat int

GetJointList() public méthode

Get the world joint list. With the returned joint, use Joint.GetNext to get the next joint in the world list. A null joint indicates the end of the list.
public GetJointList ( ) : Joint
Résultat Joint

GetPairCount() public méthode

Get the number of broad-phase pairs.
public GetPairCount ( ) : int
Résultat int

GetProxyCount() public méthode

Get the number of broad-phase proxies.
public GetProxyCount ( ) : int
Résultat int

InRange() public méthode

public InRange ( AABB aabb ) : bool
aabb Box2DX.Collision.AABB
Résultat bool

Query() public méthode

public Query ( AABB aabb, Shape shapes, int maxCount ) : int
aabb Box2DX.Collision.AABB
shapes Box2DX.Collision.Shape
maxCount int
Résultat int

Raycast() public méthode

Query the world for all shapes that intersect a given segment. You provide a shap pointer buffer of specified size. The number of shapes found is returned, and the buffer is filled in order of intersection.
public Raycast ( Segment segment, Shape shapes, int maxCount, bool solidShapes, object userData ) : int
segment Segment Defines the begin and end point of the ray cast, from p1 to p2. /// Use Segment.Extend to create (semi-)infinite rays.
shapes Shape A user allocated shape pointer array of size maxCount (or greater).
maxCount int The capacity of the shapes array.
solidShapes bool Determines if shapes that the ray starts in are counted as hits.
userData object Passed through the worlds contact filter, with method RayCollide. This can be used to filter valid shapes.
Résultat int

RaycastOne() public méthode

Performs a raycast as with Raycast, finding the first intersecting shape.
public RaycastOne ( Segment segment, float &lambda, Vec2 &normal, bool solidShapes, object userData ) : Shape
segment Segment Defines the begin and end point of the ray cast, from p1 to p2. /// Use Segment.Extend to create (semi-)infinite rays.
lambda float Returns the hit fraction. You can use this to compute the contact point /// p = (1 - lambda) * segment.p1 + lambda * segment.p2.
normal Vec2 Returns the normal at the contact point. If there is no intersection, the normal is not set.
solidShapes bool Determines if shapes that the ray starts in are counted as hits.
userData object
Résultat Shape

Refilter() public méthode

Re-filter a shape. This re-runs contact filtering on a shape.
public Refilter ( Shape shape ) : void
shape Shape
Résultat void

RemoveController() public méthode

public RemoveController ( Controllers controller ) : void
controller Controllers
Résultat void

SetBoundaryListener() public méthode

Register a broad-phase boundary listener.
public SetBoundaryListener ( BoundaryListener listener ) : void
listener BoundaryListener
Résultat void

SetContactFilter() public méthode

Register a contact filter to provide specific control over collision. Otherwise the default filter is used (b2_defaultFilter).
public SetContactFilter ( ContactFilter filter ) : void
filter ContactFilter
Résultat void

SetContactListener() public méthode

Register a contact event listener
public SetContactListener ( ContactListener listener ) : void
listener ContactListener
Résultat void

SetContinuousPhysics() public méthode

Enable/disable continuous physics. For testing.
public SetContinuousPhysics ( bool flag ) : void
flag bool
Résultat void

SetDebugDraw() public méthode

Register a routine for debug drawing. The debug draw functions are called inside the World.Step method, so make sure your renderer is ready to consume draw commands when you call Step().
public SetDebugDraw ( DebugDraw debugDraw ) : void
debugDraw DebugDraw
Résultat void

SetDestructionListener() public méthode

Register a destruction listener.
public SetDestructionListener ( DestructionListener listener ) : void
listener DestructionListener
Résultat void

SetWarmStarting() public méthode

Enable/disable warm starting. For testing.
public SetWarmStarting ( bool flag ) : void
flag bool
Résultat void

Step() public méthode

Take a time step. This performs collision detection, integration, and constraint solution.
public Step ( float dt, int velocityIterations, int positionIteration ) : void
dt float The amount of time to simulate, this should not vary.
velocityIterations int
positionIteration int
Résultat void

Validate() public méthode

Perform validation of internal data structures.
public Validate ( ) : void
Résultat void

World() public méthode

Construct a world object.
public World ( AABB worldAABB, Vec2 gravity, bool doSleep ) : System
worldAABB AABB A bounding box that completely encompasses all your shapes.
gravity Vec2 The world gravity vector.
doSleep bool Improve performance by not simulating inactive bodies.
Résultat System