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.
显示文件 Open project: gerich-home/box2dnet Class Usage Examples

Public Properties

Property Type Description
ActiveContacts int
ContactPoolCount int

Protected Properties

Property Type Description
Flags int

Public Methods

Method 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

Method 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 method

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
return void

CreateBody() public method

create a rigid body given a definition. No reference to the definition is retained.
public CreateBody ( BodyDef def ) : Body
def BodyDef
return Body

CreateJoint() public method

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
return Box2D.Dynamics.Joints.Joint

DestroyBody() public method

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
return void

DestroyJoint() public method

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

DrawDebugData() public method

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

PopContact() public method

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

PushContact() public method

public PushContact ( Contact contact ) : void
contact Box2D.Dynamics.Contacts.Contact
return void

QueryAABB() public method

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.
return void

Raycast() public method

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
return void

Step() public method

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.
return void

World() public method

public World ( Vec2 gravity ) : System
gravity Box2D.Common.Vec2
return System

World() public method

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

Property Details

ActiveContacts public_oe property

public int ActiveContacts
return int

ContactPoolCount public_oe property

public int ContactPoolCount
return int

Flags protected_oe property

protected int Flags
return int