• Advertisement
Sign in to follow this  

Up vector help

This topic is 2934 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
Sign in to follow this  

  • Advertisement