JitterWorld¶
-
class
JitterWorld
: System.Object This class brings ‘dynamics’ and ‘collisions’ together. It handles all bodies and constraints.
-
readonly Jitter.DataStructures.ReadOnlyHashset<RigidBody>
RigidBodies
-
readonly Jitter.DataStructures.ReadOnlyHashset<Constraint>
Constraints
-
readonly Jitter.DataStructures.ReadOnlyHashset<SoftBody>
SoftBodies
-
readonly Jitter.WorldEvents
Events
-
readonly ArbiterMap
ArbiterMap
Holds a list of T:Jitter.Dynamics.Arbiter. All currently active arbiter in the :World are stored in this map.
-
readonly ContactSettings
ContactSettings
-
readonly System.Collections.ObjectModel.ReadOnlyCollection<CollisionIsland>
Islands
Gets a read only collection of the T:Jitter.Collision.CollisionIsland objects managed by this class.
-
CollisionSystem
CollisionSystem
Gets the P:Jitter.JitterWorld.CollisionSystem used to detect collisions.
-
JVector
Gravity
Gets or sets the gravity in this :World. The default gravity is (0,-9.81,0)
-
bool
AllowDeactivation
Global sets or gets if a body is able to be temporarily deactivated by the engine to safe computation time. Use M:Jitter.JitterWorld.SetInactivityThreshold(System.Single,System.Single,System.Single) to set parameters of the deactivation process.
-
readonly System.Double[]
DebugTimes
-
public void
AddBody
(SoftBody body) Parameters: - body (Jitter.Dynamics.SoftBody) –
-
public bool
RemoveBody
(SoftBody body) Parameters: - body (Jitter.Dynamics.SoftBody) –
-
public void
ResetResourcePools
() In Jitter many objects get added to stacks after they were used. If a new object is needed the old object gets removed from the stack and is reused. This saves some time and also garbage collections. Calling this method removes all cached objects from all stacks.
-
public void
Clear
() Removes all objects from the world and removes all memory cached objects.
-
public void
SetDampingFactors
(float angularDamping, float linearDamping) Every computation M:Jitter.JitterWorld.Step(System.Single,System.Boolean) the angular and linear velocity of a T:Jitter.Dynamics.RigidBody gets multiplied by this value.
Parameters: - angularDamping (float) –
- The factor multiplied with the angular velocity.
- The default value is 0.85.
- linearDamping (float) –
- The factor multiplied with the linear velocity.
- The default value is 0.85
- angularDamping (float) –
-
public void
SetInactivityThreshold
(float angularVelocity, float linearVelocity, float time) Sets parameters for the T:Jitter.Dynamics.RigidBody deactivation process. If the bodies angular velocity is less than the angular velocity threshold and its linear velocity is lower then the linear velocity threshold for a specific time the body gets deactivated. A body can be reactivated by setting P:Jitter.Dynamics.RigidBody.IsActive to true. A body gets also automatically reactivated if another moving object hits it or the T:Jitter.Collision.CollisionIsland the object is in gets activated.
Parameters: - angularVelocity (float) –
- The threshold value for the angular velocity. The default value
- is 0.1.
- linearVelocity (float) –
- The threshold value for the linear velocity. The default value
- is 0.1
- time (float) – The threshold value for the time in seconds. The default value is 2.
- angularVelocity (float) –
-
public void
SetIterations
(int iterations, int smallIterations) Jitter uses an iterativ approach to solve collisions and contacts. You can set the number of iterations Jitter should do. In general the more iterations the more stable a simulation gets but also costs computation time.
Parameters: - iterations (int) – The number of contact iterations. Default value 10.
- smallIterations (int) – The number of contact iteration used for smaller (two and three constraint) systems. Default value 4.
-
public bool
RemoveBody
(RigidBody body) Removes a T:Jitter.Dynamics.RigidBody from the world.
Parameters: - body (Jitter.Dynamics.RigidBody) – The body which should be removed.
Returns: Returns false if the body could not be removed from the world.
-
public void
AddBody
(RigidBody body) Adds a T:Jitter.Dynamics.RigidBody to the world.
Parameters: - body (Jitter.Dynamics.RigidBody) – The body which should be added.
-
public bool
RemoveConstraint
(Constraint constraint) Add a T:Jitter.Dynamics.Constraints.Constraint to the world. Fast, O(1).
Parameters: - constraint (Jitter.Dynamics.Constraints.Constraint) – The constraint which should be added.
Returns: True if the constraint was successfully removed.
-
public void
AddConstraint
(Constraint constraint) Add a T:Jitter.Dynamics.Constraints.Constraint to the world.
Parameters: - constraint (Jitter.Dynamics.Constraints.Constraint) – The constraint which should be removed.
-
public void
Step
(float timestep, bool multithread) Integrates the whole world a timestep further in time.
Parameters: - timestep (float) –
- The timestep in seconds.
- It should be small as possible to keep the simulation stable. The physics simulation shouldn’t run slower than 60fps. (timestep=1/60).
- multithread (bool) –
- If true the engine uses several threads to
- integrate the world. This is faster on multicore CPUs.
- timestep (float) –
-
public void
Step
(float totalTime, bool multithread, float timestep, int maxSteps) Integrates the whole world several fixed timestep further in time.
Parameters: - totalTime (float) – The time to integrate.
- multithread (bool) –
- If true the engine uses several threads to
- integrate the world. This is faster on multicore CPUs.
- timestep (float) –
- The timestep in seconds.
- It should be small as possible to keep the simulation stable. The physics simulation shouldn’t run slower than 60fps. (timestep=1/60).
- maxSteps (int) –
- The maximum number of substeps. After that Jitter gives up
- to keep up with the given totalTime.
-
readonly Jitter.DataStructures.ReadOnlyHashset<RigidBody>