This short snippet should set the gravity to a regular (0,10), then set it to (0,0), create and object and finally set gravity back to the original (0,10)
You would expect the object created to begin dropping, as it has density, is not fixed in position in any way and the gravity is set to pull downwards - except it doesn’t. It will begin dropping, however, if the gravity does not change before (and after) the object is created.
Bug?
require("physics") physics.start() physics.setGravity(0,10) physics.setDrawMode("hybrid") print("gravity on") timer.performWithDelay( 1000, function() print("gravity off") physics.setGravity(0,0) end, 1 ) timer.performWithDelay( 2000, function() local c = display.newCircle( display.contentCenterX, display.contentCenterY, 100 ) physics.addBody( c, "dynamic", {radius=100} ) end, 1 ) timer.performWithDelay( 3000, function() print("gravity on") physics.setGravity(0,10) end, 1 )