Sign in to follow this  
Butabee

Up vector help

Recommended Posts

Butabee    274
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.

Share this post


Link to post
Share on other sites
Buckeye    10747
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this