object.isAwake

Type Boolean
Object Body
Library physics.*
Revision 2017.3179
Keywords body, isAwake
See also object.isBodyActive
object.isSleepingAllowed

Overview

A boolean for the body's current "awake" state. By default, all bodies automatically "sleep" when nothing interacts with them for a couple of seconds. At this point, they stop being simulated until something like a collision wakes them up. The isAwake property can either fetch a body's current state or forcibly wake it up.

Example

-- Create a rectangle
local myRect = display.newRect( 0, 0, 100, 100 )

-- Add a body to the rectangle
physics.addBody( myRect, "dynamic" )

-- Set the rectangle's "awake" state to true
myRect.isAwake = true