physics.start()

Type Function
Library physics.*
Return value none
Revision Release 2022.3683
Keywords physics, start
See also physics.pause()
physics.stop()

Overview

This function start the physics simulation and should be called before any other physics functions.

Gotchas

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 since it's not a direct force that "wakes" sleeping bodies.

You can override this behavior on any given body with the object.isSleepingAllowed property, or you can override it globally for all bodies in the simulation by using an optional boolean parameter in physics.start() (see below).

Syntax

physics.start( [noSleep] )
noSleep (optional)

Boolean. Value of true prevents all bodies from sleeping; false or nil allows all bodies to sleep (default mode).