# Spherical terrain (planet) how to do the physics?!

I’m looking for a technique to render a spherical terrain as my gameworld

http://imageshack.us/photo/my-images/508/uneled.png/

what i achieved so far is a minecraft like cube with 80x80x80, see it here

http://imageshack.us/photo/my-images/600/unledtkr.png/

what i wanna do is, as you can see on the first pic, using 6 heightmaps one for each face of the cube then mapping/wrapping it around a sphere. this is the easy part.

but i’m not sure how to handle physics in this environment. i’d like to use bullet physics to simulate character controllers and other objects walking and moving around the planet.

• my first idea was to simulate the physics as the player can see it in game, the world as a sphere, but this would cause a big problem, i’d have to apply different gravity vectors to all objects in my world, and the second is, character controllers in most physic engines have a axis aligned up-vector, so i can’t use em for my planet.
• my second thought was to simulate everything in one plane, (as you can see on the first pic right side), again with 6 heightmaps, if any object steps over the edge of a heightmap, and would fall off the heightmap it’s teleported to the expected next heightmap.

e.g. the player moves up on the red bordered heightmap, before he would fall of, he’s teleported to the most right heightmap

in the last step, for visualisation, all object coordinates and heightmaps are transformed to a sphere

so physic simulation happens on the x/z plane, but before rendering everything is mapped to the sphere

what problems do you see with my idea ? do you have any other ideas to implement physics in this environment?

You can set the gravity for each object based on its location continuously.

but how could i solve the problem with character controller ?

You cant