C# Class Project290.Physics.Dynamics.World

The world class manages all physics entities, dynamic simulation, and asynchronous queries.
Afficher le fichier Open project: scastle/Solitude Class Usage Examples

Méthodes publiques

Свойство Type Description
BodyAdded BodyDelegate
BodyRemoved BodyDelegate
Enabled bool
FixtureAdded FixtureDelegate
FixtureRemoved FixtureDelegate
Gravity Vector2
Island Island
JointAdded JointDelegate
JointRemoved JointDelegate

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
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.

Method Details

AddBody() public méthode

Create a rigid body.
public AddBody ( Body body ) : void
body Body
Résultat void

AddBreakableBody() public méthode

public AddBreakableBody ( BreakableBody breakableBody ) : void
breakableBody BreakableBody
Résultat void

AddController() public méthode

public AddController ( Controller controller ) : void
controller Project290.Physics.Controllers.Controller
Résultat void

AddJoint() public méthode

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.
Résultat void

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

ProcessChanges() public méthode

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
Résultat void

QueryAABB() public méthode

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.
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 ( 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.
Résultat void

RemoveBody() public méthode

Destroy a rigid body. Warning: This automatically deletes all associated shapes and joints.
public RemoveBody ( Body body ) : void
body Body The body.
Résultat void

RemoveBreakableBody() public méthode

public RemoveBreakableBody ( BreakableBody breakableBody ) : void
breakableBody BreakableBody
Résultat void

RemoveController() public méthode

public RemoveController ( Controller controller ) : void
controller Project290.Physics.Controllers.Controller
Résultat void

RemoveJoint() public méthode

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.
Résultat void

Step() public méthode

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.
Résultat void

TestPoint() public méthode

public TestPoint ( Vector2 point ) : Fixture
point Vector2
Résultat Fixture

TestPointAll() public méthode

Returns a list of fixtures that are at the specified point.
public TestPointAll ( Vector2 point ) : List
point Vector2 The point.
Résultat List

World() public méthode

Initializes a new instance of the World class.
public World ( Vector2 gravity ) : System
gravity Vector2 The gravity.
Résultat System

Property Details

BodyAdded public_oe property

Fires whenever a body has been added
public BodyDelegate BodyAdded
Résultat BodyDelegate

BodyRemoved public_oe property

Fires whenever a body has been removed
public BodyDelegate BodyRemoved
Résultat BodyDelegate

Enabled public_oe property

If false, the whole simulation stops. It still processes added and removed geometries.
public bool Enabled
Résultat bool

FixtureAdded public_oe property

Fires whenever a fixture has been added
public FixtureDelegate FixtureAdded
Résultat FixtureDelegate

FixtureRemoved public_oe property

Fires whenever a fixture has been removed
public FixtureDelegate FixtureRemoved
Résultat FixtureDelegate

Gravity public_oe property

Change the global gravity vector.
public Vector2 Gravity
Résultat Vector2

Island public_oe property

public Island,Project290.Physics.Dynamics Island
Résultat Island

JointAdded public_oe property

Fires whenever a joint has been added
public JointDelegate JointAdded
Résultat JointDelegate

JointRemoved public_oe property

Fires whenever a joint has been removed
public JointDelegate JointRemoved
Résultat JointDelegate