PDA

View Full Version : EULER ANGLES & QUATERNIONS



04-10-2003, 04:51 PM
I am trying to implement a rather simple 3rd person flight sim/flying game.
I'm getting stuck when trying to do the user controls. I've tried a bunch of stuff, now I'm using Quaternions.
So, basically, I keep track of the airplane's local i, j, k vector (representing roll, yaw, pitch). When the user decides to roll, for instance, the axes vectors are rotated around the i vector.
Once the user has input data, and the program is ready to render, it basically has i, j, and k vectors which represent the axes of the airplane.
What I've been trying to do is calculate the angles between various coordinate-planes and rotate by those angles about the axes using glRotatef().
I first calculate the values by rotating about the i, axis, then I deal with yaw, then pitch. Then I use glRotatef to rotate the airplane in the correct orientation. However, when I run this, it gives me totally, totally weird results whenever I try more than one rotation at a time.
Does anyone have any information about how to implement the plane controls, source code, or links to anywhere that I can get information? Thanks for any help at all.

JustHanging
04-10-2003, 10:03 PM
Hi,

You can get away easier if you just build your own transformation matrix for the plane and apply it with glMultMatrix. The first column vector of the matrix is the i vector, second j and third k. Or those is some other order, depends on your coordinate system. The last column is the plane's position vector and the bottom row is 0 0 0 1.

-Ilkka

Miguel_dup1
04-11-2003, 05:24 AM
I have a few camera systems on my site. I use quaternions, euler angles....
http://cheo.resnet.wayne.edu/miguel/

You should take a look at them.