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

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

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

Свойство Тип Описание
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

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

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

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

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

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

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

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

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

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

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

public addController ( Controller controller ) : void
controller FarseerPhysics.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 FarseerPhysics.Dynamics.Joints.Joint The joint.
Результат void

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

public clear ( ) : void
Результат 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

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

public overlapCircle ( Vector2 center, float radius ) : void
center Vector2
radius float
Результат void

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

public processAddedBodies ( ) : void
Результат void

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

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

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

public processRemovedBodies ( ) : void
Результат void

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

public processRemovedJoints ( ) : void
Результат void

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

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

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

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

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

public rayCast ( Vector2 point1, Vector2 point2 ) : List
point1 Vector2
point2 Vector2
Результат List

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

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

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

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

public removeJoint ( Joint joint, bool doCheck ) : void
joint Joint
doCheck bool
Результат void

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

public shiftOrigin ( Vector2 newOrigin ) : void
newOrigin Vector2
Результат void

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

public solve ( TimeStep &timeStep ) : void
timeStep TimeStep
Результат 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

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

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

public HashSet AwakeBodySet
Результат HashSet

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

public float addRemoveTime
Результат float

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

Get the world body list.
public List bodyList
Результат List

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

public List breakableBodyList
Результат List

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

Get the contact manager for testing.
public ContactManager,FarseerPhysics.Dynamics contactManager
Результат ContactManager

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

public float contactsUpdateTime
Результат float

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

public float continuousPhysicsTime
Результат float

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

public List controllerList
Результат List

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

public float controllersUpdateTime
Результат float

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

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

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

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

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

public Island island
Результат Island

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

Get the world joint list.
public List jointList
Результат List

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

public float newContactsTime
Результат float

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

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

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

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

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

Fires every time a controller is added to the World.
public ControllerDelegate onControllerAdded
Результат ControllerDelegate

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

Fires every time a controlelr is removed form the World.
public ControllerDelegate onControllerRemoved
Результат ControllerDelegate

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

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

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

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

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

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

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

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

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

public float solveUpdateTime
Результат float

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

public float updateTime
Результат float