natiny.physics.set_gravity

Lua
natiny.physics.set_gravity(x, y, z)

Sets the acceleration applied to every dynamic body.

Parameters

Name Type Description
x number Acceleration along X, m/s^2
y number Acceleration along Y, m/s^2
z number Acceleration along Z, m/s^2

Example

Lua
natiny.physics.set_gravity(0, -1.62, 0)   -- the Moon

Notes

  • The world starts at (0, -9.81, 0).
  • Takes effect on the next step. Sleeping bodies do not wake for it, so a scene that has come to rest stays at rest until something disturbs it.
  • Does nothing when physics is not running.