Setting World Gravity in Python

Ok, I remember playing a game ounce that had a script that set the gravity. I know you can easily set the gravity in the world button, but if I want to change it during the game or set it above 25 I can’t with it. I also know you can just add a force of -x on global z axis on an object, but it would be way more easier if I just had a python to set the world gravity. Can anyone post a script here?

Sorry I had to make a whole thread about it, I just wanted a quick response. I searched for it with different keywords and it never came up with anything.


import PhysicsConstraints as physCon


Change -9.8 to whatever you wish.

(I have to have at least 10 characters to post)

What happened to

grav = 9.8
GameLogic.setGravity([0.0, 0.0, -grav])


Both works… if one hasn’t been removed in 2.49.