Jump to content
  • Advertisement
Sign in to follow this  
beebs1

Space Controls

This topic is 2548 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

Hiya,

I've edited this question, as it was poorly thought out.

Given a normalised direction vector, does anyone know how to find rotations around the x- and y-axis (pitch and yaw) which are equivalent?

From what I've read, I believe this is converting a vector into Euler angles, but I'm not entirely sure.

My reason for asking is that I have a space-ship object which can yaw and pitch, and I keep track of its orientation as a single direction vector. The pitch can never reach +/- 90 degrees, so the ship cannot become inverted - neither can it roll. I need to find the correct x/y rotation angles to pass to glRotatef().

Many thanks :)

Share this post


Link to post
Share on other sites
Advertisement
Yes, this is just converting a vector to Euler angles. There should be a billion or so references on how to do that floating around the web :-)

Share this post


Link to post
Share on other sites

Hiya,

I've edited this question, as it was poorly thought out.

Given a normalised direction vector, does anyone know how to find rotations around the x- and y-axis (pitch and yaw) which are equivalent?

From what I've read, I believe this is converting a vector into Euler angles, but I'm not entirely sure.

My reason for asking is that I have a space-ship object which can yaw and pitch, and I keep track of its orientation as a single direction vector. The pitch can never reach +/- 90 degrees, so the ship cannot become inverted - neither can it roll. I need to find the correct x/y rotation angles to pass to glRotatef().

Many thanks :)

Project the vector onto the YZ plane and take the dot product with the Z-axis to get the cosine of the pitch angle.
Project the vector onto the XZ plane and take the dot product with the Z-axis to get the cosine of the yaw angle.

This assumes positive Z is your intial direction vector.
XYZ axis here are your orientation base axis.

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!