Advertisement

Rotate a line with two Quaternions (yaw / pitch)

Started by March 20, 2016 07:13 PM
1 comment, last by treeRunner 8 years, 5 months ago

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

does the desired flight model use local or global rotations?

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

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Advertisement

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

This topic is closed to new replies.

Advertisement