Up vector help

Started by
1 comment, last by Buckeye 14 years, 2 months ago
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.
Advertisement
A normalized vector of the sphere center and position of the player would be a good start.
"It's like naming him Asskicker Monstertrucktits O'Ninja" -Khaiy

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.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement