C# Класс Box2D.Dynamics.World

The world class manages all physics entities, dynamic simulation, and asynchronous queries. The world also contains efficient memory management facilities.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
ActiveContacts int
ContactPoolCount int

Защищенные свойства (Protected)

Свойство Тип Описание
Flags int

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

ClearForces() публичный Метод

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
Результат void

CreateBody() публичный Метод

create a rigid body given a definition. No reference to the definition is retained.
public CreateBody ( BodyDef def ) : Body
def BodyDef
Результат Body

CreateJoint() публичный Метод

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
Результат Box2D.Dynamics.Joints.Joint

DestroyBody() публичный Метод

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
Результат void

DestroyJoint() публичный Метод

destroy a joint. This may cause the connected bodies to begin colliding.
public DestroyJoint ( Joint j ) : void
j Box2D.Dynamics.Joints.Joint
Результат void

DrawDebugData() публичный Метод

Call this to draw shapes and other debug draw data.
public DrawDebugData ( ) : void
Результат void

PopContact() публичный Метод

public PopContact ( Fixture fixtureA, int indexA, Fixture fixtureB, int indexB ) : Contact
fixtureA Fixture
indexA int
fixtureB Fixture
indexB int
Результат Box2D.Dynamics.Contacts.Contact

PushContact() публичный Метод

public PushContact ( Contact contact ) : void
contact Box2D.Dynamics.Contacts.Contact
Результат void

QueryAABB() публичный Метод

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.
Результат void

Raycast() публичный Метод

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
Результат void

Step() публичный Метод

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.
Результат void

World() публичный Метод

public World ( Vec2 gravity ) : System
gravity Box2D.Common.Vec2
Результат System

World() публичный Метод

Construct a world object.
public World ( Vec2 gravity, IWorldPool argPool ) : System
gravity Box2D.Common.Vec2 the world gravity vector.
argPool IWorldPool
Результат System

Описание свойств

ActiveContacts публичное свойство

public int ActiveContacts
Результат int

ContactPoolCount публичное свойство

public int ContactPoolCount
Результат int

Flags защищенное свойство

protected int Flags
Результат int