×
A new build of Corona SDK is now available to subscribers. Not a subscriber? Subscribe now.
CoronaSDK 2014.2282 | Released: 24 Apr 2014, 1:00pm | What's New | Download Now

physics.getGravity()

Description:

Returns the x,y components of the global gravity vector, in units of m/s2. This takes advantage of the fact that Lua functions can return multiple values.

Syntax:

gx, gy = physics.getGravity()

Example:

gx, gy = physics.getGravity()
print( "X gravity: " .. gx .. ", Y gravity: " .. gy )

Parameters:

None.

Returns:

gx
The global gravity vector in X direction, in units of m/s2.

gy
The global gravity vector in Y direction, in units of m/s2.

Remarks:
Supported on operating systems and platforms for build numbers shown:
  • Mac OS X:
    Corona SDK 2.0
  • Windows:
    Corona SDK 2.0
  • iOS:
    Corona SDK 2.0
  • Android:
    Corona SDK 2.0