Type Function Library physics.* Return value Numbers Revision 2017.3060 Keywords physics, gravity See also physics.setGravity()
Returns the x and y components of the global gravity vector, in units of m/s². This takes advantage of the fact that Lua functions can return multiple values, which in this case are:
gx
— The global gravity vector in the x direction, in units of m/s².gy
— The global gravity vector in the y direction, in units of m/s².physics.getGravity()
local gx, gy = physics.getGravity() print( "x gravity: " .. gx .. ", y gravity: " .. gy )