• Advertisement
Sign in to follow this  

Space Controls

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

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