I’m working on a project in BGE where I wish to make a round planet that the player can walk on. Including proper respecting of gravity, and ability to use physical objects that still move accordingly. I asked for help on IRC, and someone was kind enough to make a full gravity script that would do all these things. Since this should be a useful and fun template, I thought I should post it here.
Features: Player can walk on a sphere and move in any direction (including both walking and jumping). Physical objects will still collide and roll around like they should. When viewing through the camera, the movement looks perfectly realistic and nothing looks or acts as “reversed”, keeping immersion intact. The script also supports multiple planets, and if the player could jump from sphere one to another, he would fall into its gravity range and be pulled toward that planet instead.
Credits: Script and blend file made by Jace Priester.
SphericalGravityTest.blend (431 KB)