physics.pause()

Type Function
Library physics.*
Return value none
Revision Current Public Release (2014.2511)
Keywords physics, pause, pausing, simulation
See also physics.start()

Overview

Pause the physics engine.

Syntax

physics.pause()

Example

local isPaused = false

function pausePhysics( event )
    if "began" == event.phase then
        if isPaused == false then
            physics.pause()
            isPaused = true
        elseif isPaused == true then
            physics.start()
            isPaused = false
        end
    end
end

Runtime:addEventListener( "touch", pausePhysics )
physics.start()
-- pause physics simulation after 3 seconds
timer.performWithDelay( 3000, function()

    physics.pause()

end, 1 )