For a game I am making I need a way to move along a round surface and have a poll to the center. I need a few thing, I need to be able to fall towards the planet, I need to move across the planets surface without going off in odd directions, and I need for “Up” to be away from the center at all times.
I have googled this in every way I can, and the only things I found caused more issues then fixed. It has come to the point where I am sure there is no way to have a round game world!
These guys talk a bit about the problem: Unite 2013 - Burn the lot: Reinventing Gravity & Hunting Carnies - YouTube
I wouldn’t do 3D gravity pointing to the planet center, but calculate the gravity force as a float and only in the last step apply it in the direction of the center of the planet.
You’re basically managing the players height above planet ground as if if was 2D, just that your negative y coordinate is pointing to the center at all times.
Also rotate the player, so his feet always point to the center and then you just basically apply horizontal and vertical movement, but from the players perspective.
Watch out that you don’t use euler angles anywhere or gimbal lock will bite you.
I happen to be working on the same thing for my game and got it working with the help of this post
While I don’t use the JumptoWall stuff yet, the other code provides what I needed to walk around my somewhat spherical model 360degrees. I was able to modify it such that I didn’t need my player to be a child of the boxcollider/rigidbody object, I just added those to the player and turn them on/off when I need them or don’t.