Sign in to follow this  
No_Germs

Orientation using Yaw-pitch-roll

Recommended Posts

No_Germs    151
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 this post


Link to post
Share on other sites
Cygon    1219
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 this post


Link to post
Share on other sites
No_Germs    151
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...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this