Collider:setSleepingAllowed

Edit

Sets whether the Collider is allowed to automatically go to sleep.

When enabled, the Collider will go to sleep if it hasn't moved in a while. The physics engine does not simulate movement for colliders that are asleep, which saves a lot of CPU for a typical physics world where most objects are at rest at any given time.

Collider:setSleepingAllowed(sleepy)

Arguments

NameTypeDescription
sleepyboolean Whether the Collider can go to sleep.

Returns

Nothing

Notes

Sleeping is enabled by default. Sleeping can be disabled globally using the allowSleep option in lovr.physics.newWorld.

Colliders can still be put to sleep manually with Collider:setAwake, even if automatic sleeping is disabled.

Sleeping colliders will wake up when:

Notably, the following will not wake up the collider:

Sensors will never go to sleep.

See also