Click or drag to resize
DigitalRuneSleeping

This section explains the simulation concept of sleeping.

Sleeping

Sleeping is also known as deactivation: Rigid bodies that do not move for a certain amount of time are deactivated ("put to sleep"). The simulation will do less work for sleeping bodies which results in a performance gain. Bodies are also put to sleep if they have a very low velocity for a certain duration. The velocity of sleeping bodies is clamped to zero, which means that sleeping also improves the simulation stability by removing small (possible erroneous) velocities.

Rigid bodies will start to sleep if their linear velocity is below a threshold for a certain time. The exact settings can be configured in SleepingSettings (see SimulationSettings).

The RigidBody class also has several sleep related methods and properties, see CanSleep, IsSleeping, Sleep and WakeUp. Rigid bodies wake up automatically when important properties, such as the shape or mass, are changed.

Simulation Islands can only sleep as a whole. It is not possible that some bodies in an island are sleeping and others are awake. If one object is awake, all objects are awake because the movement of the active body can propagate to the other bodies. In unfortunate configurations a jittering body can keep a whole island awake.

See Also