Collider:isSleepingAllowed

Edit

Returns 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.

sleepy = Collider:isSleepingAllowed()

Arguments

None

Returns

NameTypeDescription
sleepyboolean Whether the Collider can go to sleep.

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