Public Group

# Space Controls

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

## 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 on other sites
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 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.

1. 1
2. 2
3. 3
Rutin
23
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633653
• Total Posts
3013166
×