Wakes this physics body if it is currently asleep, returning it to active simulation. Once awake, the body will resume participating in collisions and physics updates.undefined
This Game Object instance.
Enables or disables the Sleep End event for this body.
true to enable the SLEEP_END event for this body, or false to disable it.
This Game Object instance.
Enable sleep and wake events for this body.
By default when a body goes to sleep, or wakes up, it will not emit any events.
The events are emitted by the Matter World instance and can be listened to via
the SLEEP_START and SLEEP_END events.
true if you want the sleep start event to be emitted for this body.
true if you want the sleep end event to be emitted for this body.
This Game Object instance.
Enables or disables the Sleep Start event for this body.
true to enable the SLEEP_START event for this body, or false to disable it.
This Game Object instance.
Sets the number of updates in which this body must have near-zero velocity before it is set as sleeping (if sleeping is enabled by the engine).
Optionalvalue: number
The number of consecutive updates with near-zero velocity required before the body is put to sleep. Default 60.
This Game Object instance.
Immediately puts this physics body to sleep, removing it from active simulation.
A sleeping body will not move, generate collisions, or consume CPU until it is woken.
It can be woken manually via setAwake, or automatically when struck by another body.undefined
This Game Object instance.
Provides methods for controlling the sleep state of a Matter.js physics body. Sleep is a performance optimization in Matter.js: when a body has had near-zero velocity for a set number of updates, the engine can put it to sleep, temporarily removing it from active simulation. Sleeping bodies do not participate in collision detection or physics updates, which can significantly reduce CPU overhead in scenes with many idle bodies. When a sleeping body is disturbed by a collision or a manual wake call, it is reactivated automatically. This component should be used as a mixin and not directly.