Type Function Library physics.* Return value none Revision 2017.3060 Keywords physics, start, begin See also physics.stop()
This function start the physics simulation and should be called before any other physics functions.
By default, physical bodies not involved in a collision will "sleep" after a few seconds. This reduces performance overhead, but in some cases you may not want this behavior. This is particularly true in apps that use the accelerometer to effect changes in physics gravity — in this case, sleeping bodies will not respond to changes in the direction of gravity.
You can override this behavior on any given body with the body.isSleepingAllowed = false
command (reference), or override it globally for all bodies in the world by using an optional boolean parameter in physics.start()
(see Syntax below).
The following lines should typically be at the top of the main.lua
file.
local physics = require( "physics" ) physics.start()
physics.start( noSleep )
Boolean. true
prevent all bodies from sleeping; false
allows all bodies to sleep (default mode).