C# Class Box2D.Dynamics.World

The world class manages all physics entities, dynamic simulation, and asynchronous queries. The world also contains efficient memory management facilities.
Afficher le fichier Open project: gerich-home/box2dnet Class Usage Examples

Méthodes publiques

Свойство Type Description
ActiveContacts int
ContactPoolCount int

Protected Properties

Свойство Type Description
Flags int

Méthodes publiques

Méthode Description
ClearForces ( ) : void

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.

CreateBody ( BodyDef def ) : Body

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

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.

DestroyBody ( Body body ) : void

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

DestroyJoint ( Joint j ) : void

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

DrawDebugData ( ) : void

Call this to draw shapes and other debug draw data.

PopContact ( Fixture fixtureA, int indexA, Fixture fixtureB, int indexB ) : Contact
PushContact ( Contact contact ) : void
QueryAABB ( IQueryCallback callback, AABB aabb ) : void

Query the world for all fixtures that potentially overlap the provided AABB.

Raycast ( IRayCastCallback callback, Vec2 point1, Vec2 point2 ) : void

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.

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

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

World ( Vec2 gravity ) : System
World ( Vec2 gravity, IWorldPool argPool ) : System

Construct a world object.

Private Methods

Méthode Description
AddType ( IDynamicStack creator, ShapeType type1, ShapeType type2 ) : void
DrawJoint ( Joint joint ) : void
DrawShape ( Fixture fixture, Transform xf, Color3f color ) : void
InitializeRegisters ( ) : void
Solve ( TimeStep step ) : void
SolveToi ( TimeStep step ) : void

Method Details

ClearForces() public méthode

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

CreateBody() public méthode

create a rigid body given a definition. No reference to the definition is retained.
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.
public CreateJoint ( JointDef def ) : Joint
def Box2D.Dynamics.Joints.JointDef
Résultat Box2D.Dynamics.Joints.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.
public DestroyBody ( Body body ) : void
body Body
Résultat void

DestroyJoint() public méthode

destroy a joint. This may cause the connected bodies to begin colliding.
public DestroyJoint ( Joint j ) : void
j Box2D.Dynamics.Joints.Joint
Résultat void

DrawDebugData() public méthode

Call this to draw shapes and other debug draw data.
public DrawDebugData ( ) : void
Résultat void

PopContact() public méthode

public PopContact ( Fixture fixtureA, int indexA, Fixture fixtureB, int indexB ) : Contact
fixtureA Fixture
indexA int
fixtureB Fixture
indexB int
Résultat Box2D.Dynamics.Contacts.Contact

PushContact() public méthode

public PushContact ( Contact contact ) : void
contact Box2D.Dynamics.Contacts.Contact
Résultat void

QueryAABB() public méthode

Query the world for all fixtures that potentially overlap the provided AABB.
public QueryAABB ( IQueryCallback callback, AABB aabb ) : void
callback IQueryCallback a user implemented callback class.
aabb Box2D.Collision.AABB the query box.
Résultat void

Raycast() public méthode

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.
public Raycast ( IRayCastCallback callback, Vec2 point1, Vec2 point2 ) : void
callback IRayCastCallback a user implemented callback class.
point1 Box2D.Common.Vec2 the ray starting point
point2 Box2D.Common.Vec2 the ray ending point
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 positionIterations ) : void
dt float the amount of time to simulate, this should not vary.
velocityIterations int for the velocity constraint solver.
positionIterations int for the position constraint solver.
Résultat void

World() public méthode

public World ( Vec2 gravity ) : System
gravity Box2D.Common.Vec2
Résultat System

World() public méthode

Construct a world object.
public World ( Vec2 gravity, IWorldPool argPool ) : System
gravity Box2D.Common.Vec2 the world gravity vector.
argPool IWorldPool
Résultat System

Property Details

ActiveContacts public_oe property

public int ActiveContacts
Résultat int

ContactPoolCount public_oe property

public int ContactPoolCount
Résultat int

Flags protected_oe property

protected int Flags
Résultat int