Jump to content
  • Advertisement
Sign in to follow this  
mbruenjes

Sphere Coordinates and Rotation

This topic is 4832 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 have troubles with my spherical camera class. The camera should always stay behind my figure, but if the figures rotates, the camera rotates just 90° to the left and to the right (phi, i think). Theta (?) can rotate 360°, but it´s the wrong direction (up and down). Is it possible to rotate around the complete sphere, or should i juse quaternions instead? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
It sounds like you just have some things swapped around. You might post the relevant code, and also tell us which directions are up and forward in your game.

Share this post


Link to post
Share on other sites
Thanks for your reply.

I´m currently at work so i post some code later.

What i remember is this:

position.x = radius*sinf(0.2*D3DX_PI)*cosf(phi)+figure.x;
position.y = radius*sinf(0.2*D3DX_PI)*sinf(0.5*D3DX_PI)+figure.y;
position.z = radius*sinf(0.2*D3DX_PI)+figure.z;

phi is changable and the other angles ends in a fixed position behind the figure.
position is camera´s position-vector and position.x moves the camera left and right.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!