C# Класс Project290.Physics.Dynamics.World

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

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

Свойство Тип Описание
BodyAdded BodyDelegate
BodyRemoved BodyDelegate
Enabled bool
FixtureAdded FixtureDelegate
FixtureRemoved FixtureDelegate
Gravity Vector2
Island Island
JointAdded JointDelegate
JointRemoved JointDelegate

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

Метод Описание
AddBody ( Body body ) : void

Create a rigid body.

AddBreakableBody ( BreakableBody breakableBody ) : void
AddController ( Controller controller ) : void
AddJoint ( Joint joint ) : void

Create a joint to constrain bodies together. This may cause the connected bodies to cease colliding.

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.

ProcessChanges ( ) : void

All adds and removes are cached by the World duing a World step. To process the changes before the world updates again, call this method.

QueryAABB ( bool>.Func callback, AABB &aabb ) : void

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

RayCast ( RayCastCallback callback, Vector2 point1, Vector2 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.

RemoveBody ( Body body ) : void

Destroy a rigid body. Warning: This automatically deletes all associated shapes and joints.

RemoveBreakableBody ( BreakableBody breakableBody ) : void
RemoveController ( Controller controller ) : void
RemoveJoint ( Joint joint ) : void

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

Step ( float dt ) : void

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

TestPoint ( Vector2 point ) : Fixture
TestPointAll ( Vector2 point ) : List

Returns a list of fixtures that are at the specified point.

World ( Vector2 gravity ) : System

Initializes a new instance of the World class.

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

Метод Описание
ProcessAddedBodies ( ) : void
ProcessAddedJoints ( ) : void
ProcessRemovedBodies ( ) : void
ProcessRemovedJoints ( ) : void
QueryAABBCallbackWrapper ( int proxyId ) : bool
RayCastCallbackWrapper ( RayCastInput &input, int proxyId ) : float
Solve ( TimeStep &step ) : void
SolveTOI ( TimeStep &step ) : void

Find TOI contacts and solve them.

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

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

Create a rigid body.
public AddBody ( Body body ) : void
body Body
Результат void

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

public AddBreakableBody ( BreakableBody breakableBody ) : void
breakableBody BreakableBody
Результат void

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

public AddController ( Controller controller ) : void
controller Project290.Physics.Controllers.Controller
Результат void

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

Create a joint to constrain bodies together. This may cause the connected bodies to cease colliding.
public AddJoint ( Joint joint ) : void
joint Project290.Physics.Dynamics.Joints.Joint The joint.
Результат 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

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

All adds and removes are cached by the World duing a World step. To process the changes before the world updates again, call this method.
public ProcessChanges ( ) : void
Результат void

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

Query the world for all fixtures that potentially overlap the provided AABB.
public QueryAABB ( bool>.Func callback, AABB &aabb ) : void
callback bool>.Func A user implemented callback class.
aabb Project290.Physics.Collision.AABB The aabb 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 ( RayCastCallback callback, Vector2 point1, Vector2 point2 ) : void
callback RayCastCallback A user implemented callback class.
point1 Vector2 The ray starting point.
point2 Vector2 The ray ending point.
Результат void

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

Destroy a rigid body. Warning: This automatically deletes all associated shapes and joints.
public RemoveBody ( Body body ) : void
body Body The body.
Результат void

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

public RemoveBreakableBody ( BreakableBody breakableBody ) : void
breakableBody BreakableBody
Результат void

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

public RemoveController ( Controller controller ) : void
controller Project290.Physics.Controllers.Controller
Результат void

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

Destroy a joint. This may cause the connected bodies to begin colliding.
public RemoveJoint ( Joint joint ) : void
joint Project290.Physics.Dynamics.Joints.Joint The joint.
Результат void

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

Take a time step. This performs collision detection, integration, and consraint solution.
public Step ( float dt ) : void
dt float The amount of time to simulate, this should not vary.
Результат void

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

public TestPoint ( Vector2 point ) : Fixture
point Vector2
Результат Fixture

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

Returns a list of fixtures that are at the specified point.
public TestPointAll ( Vector2 point ) : List
point Vector2 The point.
Результат List

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

Initializes a new instance of the World class.
public World ( Vector2 gravity ) : System
gravity Vector2 The gravity.
Результат System

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

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

Fires whenever a body has been added
public BodyDelegate BodyAdded
Результат BodyDelegate

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

Fires whenever a body has been removed
public BodyDelegate BodyRemoved
Результат BodyDelegate

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

If false, the whole simulation stops. It still processes added and removed geometries.
public bool Enabled
Результат bool

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

Fires whenever a fixture has been added
public FixtureDelegate FixtureAdded
Результат FixtureDelegate

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

Fires whenever a fixture has been removed
public FixtureDelegate FixtureRemoved
Результат FixtureDelegate

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

Change the global gravity vector.
public Vector2 Gravity
Результат Vector2

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

public Island,Project290.Physics.Dynamics Island
Результат Island

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

Fires whenever a joint has been added
public JointDelegate JointAdded
Результат JointDelegate

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

Fires whenever a joint has been removed
public JointDelegate JointRemoved
Результат JointDelegate