Type Boolean Object Body Library physics.* Revision Release 2022.3683 Keywords body, isSleepingAllowed See also object.isAwake
A boolean for whether a body is allowed to "sleep." The default is true
.
Keeping bodies awake has a larger computational overhead and it's usually not required because collisions with other bodies will automatically wake them up. However, forcing the "awake" state is useful in cases such as
-- Create a rectangle local myRect = display.newRect( 0, 0, 100, 100 ) -- Add a body to the rectangle physics.addBody( myRect, "dynamic" ) -- Prevent the rectangle's ability to "sleep" myRect.isSleepingAllowed = false