C# Class FarseerPhysics.Dynamics.World

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

Méthodes publiques

Свойство Type Description
AwakeBodySet HashSet
addRemoveTime float
bodyList List
breakableBodyList List
contactManager ContactManager
contactsUpdateTime float
continuousPhysicsTime float
controllerList List
controllersUpdateTime float
enabled bool
gravity Vector2
island Island
jointList List
newContactsTime float
onBodyAdded BodyDelegate
onBodyRemoved BodyDelegate
onControllerAdded ControllerDelegate
onControllerRemoved ControllerDelegate
onFixtureAdded FixtureDelegate
onFixtureRemoved FixtureDelegate
onJointAdded JointDelegate
onJointRemoved JointDelegate
solveUpdateTime float
updateTime float

Méthodes publiques

Méthode Description
World ( Vector2 gravity ) : System

Initializes a new instance of the World class.

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.

clear ( ) : void
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.

overlapCircle ( Vector2 center, float radius ) : void
processAddedBodies ( ) : void
processAddedJoints ( ) : void
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.

processRemovedBodies ( ) : void
processRemovedJoints ( ) : void
queryAABB ( AABB &aabb ) : List

Query the world for all fixtures that potentially overlap the provided AABB. Use the overload with a callback for filtering and better performance.

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

Query the world for all fixtures that potentially overlap the provided AABB. Inside the callback: Return true: Continues the query Return false: Terminate the query

rayCast ( Vector2 point1, Vector2 point2 ) : List
rayCast ( Func 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. Inside the callback: return -1: ignore this fixture and continue return 0: terminate the ray cast return fraction: clip the ray to this point return 1: don't clip the ray and continue

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.

removeJoint ( Joint joint, bool doCheck ) : void
shiftOrigin ( Vector2 newOrigin ) : void
solve ( TimeStep &timeStep ) : void
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.

Private Methods

Méthode Description
addBody ( Body body ) : void

Add a rigid body.

queryAABBCallbackWrapper ( int proxyId ) : bool
rayCastCallbackWrapper ( RayCastInput rayCastInput, int proxyId ) : float
testPointAllCallback ( Fixture fixture ) : bool
testPointCallback ( Fixture fixture ) : bool

Method Details

World() public méthode

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

addBreakableBody() public méthode

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

addController() public méthode

public addController ( Controller controller ) : void
controller FarseerPhysics.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 FarseerPhysics.Dynamics.Joints.Joint The joint.
Résultat void

clear() public méthode

public clear ( ) : void
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

overlapCircle() public méthode

public overlapCircle ( Vector2 center, float radius ) : void
center Vector2
radius float
Résultat void

processAddedBodies() public méthode

public processAddedBodies ( ) : void
Résultat void

processAddedJoints() public méthode

public processAddedJoints ( ) : 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

processRemovedBodies() public méthode

public processRemovedBodies ( ) : void
Résultat void

processRemovedJoints() public méthode

public processRemovedJoints ( ) : void
Résultat void

queryAABB() public méthode

Query the world for all fixtures that potentially overlap the provided AABB. Use the overload with a callback for filtering and better performance.
public queryAABB ( AABB &aabb ) : List
aabb AABB The aabb query box.
Résultat List

queryAABB() public méthode

Query the world for all fixtures that potentially overlap the provided AABB. Inside the callback: Return true: Continues the query Return false: Terminate the query
public queryAABB ( bool>.Func callback, AABB &aabb ) : void
callback bool>.Func A user implemented callback class.
aabb AABB The aabb query box.
Résultat void

rayCast() public méthode

public rayCast ( Vector2 point1, Vector2 point2 ) : List
point1 Vector2
point2 Vector2
Résultat List

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. Inside the callback: return -1: ignore this fixture and continue return 0: terminate the ray cast return fraction: clip the ray to this point return 1: don't clip the ray and continue
public rayCast ( Func callback, Vector2 point1, Vector2 point2 ) : void
callback Func 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 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 Joint The joint.
Résultat void

removeJoint() public méthode

public removeJoint ( Joint joint, bool doCheck ) : void
joint Joint
doCheck bool
Résultat void

shiftOrigin() public méthode

public shiftOrigin ( Vector2 newOrigin ) : void
newOrigin Vector2
Résultat void

solve() public méthode

public solve ( TimeStep &timeStep ) : void
timeStep TimeStep
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

Property Details

AwakeBodySet public_oe property

public HashSet AwakeBodySet
Résultat HashSet

addRemoveTime public_oe property

public float addRemoveTime
Résultat float

bodyList public_oe property

Get the world body list.
public List bodyList
Résultat List

breakableBodyList public_oe property

public List breakableBodyList
Résultat List

contactManager public_oe property

Get the contact manager for testing.
public ContactManager,FarseerPhysics.Dynamics contactManager
Résultat ContactManager

contactsUpdateTime public_oe property

public float contactsUpdateTime
Résultat float

continuousPhysicsTime public_oe property

public float continuousPhysicsTime
Résultat float

controllerList public_oe property

public List controllerList
Résultat List

controllersUpdateTime public_oe property

public float controllersUpdateTime
Résultat float

enabled public_oe property

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

gravity public_oe property

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

island public_oe property

public Island island
Résultat Island

jointList public_oe property

Get the world joint list.
public List jointList
Résultat List

newContactsTime public_oe property

public float newContactsTime
Résultat float

onBodyAdded public_oe property

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

onBodyRemoved public_oe property

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

onControllerAdded public_oe property

Fires every time a controller is added to the World.
public ControllerDelegate onControllerAdded
Résultat ControllerDelegate

onControllerRemoved public_oe property

Fires every time a controlelr is removed form the World.
public ControllerDelegate onControllerRemoved
Résultat ControllerDelegate

onFixtureAdded public_oe property

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

onFixtureRemoved public_oe property

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

onJointAdded public_oe property

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

onJointRemoved public_oe property

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

solveUpdateTime public_oe property

public float solveUpdateTime
Résultat float

updateTime public_oe property

public float updateTime
Résultat float