Up vector help
I'm trying to make a game where a player moves around a sphere while always having his head pointing outwards from the sphere.
The problem is, if I set the players orientation so his head is always pointing away from the sphere, it ruins the physics calculations and my player sometimes falls through the ground.
So, I don't know what to do. I think I need to set an up vector so it's always locking the players head outwards from the sphere, but I don't know what that up vector would be. I know I need to find it out based on the players position, I just don't know how to figure it out though.
I'm pretty bad at math so I was hoping someone here could help.
A normalized vector of the sphere center and position of the player would be a good start.
As mrchrismnh mentioned, the normalized vector playerPosition-sphereCenter is the "local" up vector. With regard to your physics calc, if it's any help, the tangent plane to the sphere where the player is position is the plane defined by the playerPosition and that normal. If you're doing a gravity calc, the local force of gravity is -normal*g.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement