# Rotate a line with two Quaternions (yaw / pitch)

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

## Recommended Posts

Hi people,

I currently can't wrap my brain around this problem:

[attachment=31181:yawpitch.jpg]

X = Red

Y = Green

Z = Blue

I can calculate the Quaternion for the brown line simply with

yaw = 45;
y_axis = new Vector3(0, 1, 0);
Quaternion around_y_axis = Quaternion.fromAxisAngle(y_axis, yaw);

Based on left/right-mouseinput which adds to "yaw" I can simply rotate the line on the Red/Blue plane, but how can the line be moved up/down based on the top-bottom-mouseinput (pitch)?

The yaw axis is pretty simple, since it's just rotating around (0,1,0), but the pitch axis depends on the around_x_axis-Quaternion now?

I hope somebody can make some sense out of this and can help out with the math. When anything is unclear, please just ask and I will try to explain it better.

Regards,

treeRunner

##### Share on other sites

does the desired flight model use local or global rotations?

how to do it depends on the answer to that question.

##### Share on other sites

atm it's a simple opengl scene with no rotation (local so to say)

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633737
• Total Posts
3013608
×