physics.getGravity()

Type Function
Library physics.*
Return value Numbers
Revision Release 2022.3683
Keywords physics, gravity
See also physics.setGravity()

Overview

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:

Syntax

physics.getGravity()

Example

local gx, gy = physics.getGravity()
print( "x gravity: " .. gx .. ", y gravity: " .. gy )