Orientation using Yaw-pitch-roll

Recommended Posts

I'm trying to simulate the movement of a plane, and i'm having problems with the direction vector. is the method i'm working with right? i'm only keeping track of the roll angle, and when the user "pulls" the stick of the plane, the following happens: 1. the direction vector is rotated -RollAngle round the X Axis. 2. the direction vector is rotated N degrees round the Y Axis. 3. the direction vector is rotated +RollAngle round the X axis. but this doesn't work...

Share on other sites
Yaw-Pitch-Roll vectors don't work. Ever.

I wouldn't even recommend it for Quake-style games, thought you could, rotating x, then y, then z possibly get acceptable results with it.

For flight simulator type games you need to apply at least 2 axes in object space, that is, on the already rotated plane. Use a matrix to store the plane's orientation (and do not rebuilt it from a yaw-pitch-roll vector each frame or something like that). To rotate the plane on its individual axes, you should create a temporary rotation matrix and multiple that matrix by the plane's matrix (not the other way around, operand order is important in linear algebra) and use the result as the plane's new orientation matrix.

This would give you Freelancer-style plane rotations. It could also be done with quaternions, but not with a yaw-pitch-roll vector ;)

-Markus-

Share on other sites
and then i just add the plane's orientation matrix's X Axis Components to the speed vector's compnents, right (hope i'm not mixing it up...)?

Share on other sites
Okee dokee, works like a charm, thanks a lot

Share on other sites
One Last Question- i thought i could just set opengl's modelview matrix to the plane's orientation matrix so the plane would be drawn correctly, but instead it's drawn from the wrong angle... i tried drawing the orientation matrix's X Y and Z Axis to see if at least that works correctly, and it does, the matrix behaves exactly as i want it. so why when i use it as the modelview matrix it doesn't work right?
i know it's half an opengl\graphics question, but it's too related to this sub...

Create an account

Register a new account

• Forum Statistics

• Total Topics
628367
• Total Posts
2982284

• 10
• 9
• 13
• 24
• 11