Game Logic: setGravity

setGravity(gravity)
  • Sets the world gravity using the world x, y and z axis.

gravity:

  • Type:  float list [ x, y, z]
  • x = gravity force on world x-axis
  • y = gravity force on world y-axis
  • z = gravity force on world z-axis
Note:
  • Default gravity is -9.8 on the world z-axis.
Sample Code

################## set the world gravity
     

# import bge
import bge

# Set the world gravity to half (-4.9) on the z axis
bge.logic.setGravity([ 0.0, 0.0, -4.9])