I am currently writing a Flight simulator, using OpenGL and Glut in c
I have found some dificulty in getting the rotations of the view to function how I hoped they would
I know each rotation must occure in the coordinate system of the planes mothion rather than the world coordinate system.
to explain as I adont think I'm making any sense, to pitch forward or back, this is a rotation in the axis defined by the wings (possably tip to tip). to roll the plane it must be rotated about the axis defined by the direction the plane is pointing, so from nose to tail. and to yaw or use the rudder the rotation must occure about the upward direction of the plane, these axis would be centered at the center of the plane
I have a choice of rotating either the up and direction vectors of the plane and then using glulookat() to position the plane in the world where it should be
or leave the camera at the center and rotate the world about it
at the current state I'm performing the rotations on the world, using my own matrix for the planes rotations, with a new rotation added each time
however to display the world I I use gltranslate to position the objects and load the matrix to do the rotations
glLoadMatrixf(m); //loads my matrix
glTranslatef(-plane.position.Vals,-plane.position.Vals,-plane.position.Vals); // translates it
glCallList(landtile); // loads the landscape
I have also tried using glmultmatrix after the gl translate call but this made no visable difference
I hope some one can help me with this
I'm attaching the current system so you can see whats happening
use your numberpad to controll the rotations 2+8 pitch, 4+6 roll, 1+3 yaw. this is coded to the numbers.
PS I cant ask anyone to write me the code to fix this as its for a uni project, but pointers in the right direction or algorithms will be greatly appreciated