PDA

View Full Version : 6 Degrees of Freedom



ssaunders
01-02-2001, 12:51 PM
Firstly, the application I am writing is a flight simulator which should have six degrees of freedom for the movement. I am having trouble with the pitch in that if you increase it enough, pressing the FORWARD key actually moves the aircraft backwards. I think it is because I am using trig functions (and they are cyclic in nature), but am not sure. If someone can help with this I would be really greatful.

Also, how would you do the roll of the aircraft (and in what order would you do the rotations using glRotate)

Thanks very much for any help,
Steve

Tim Stirling
01-03-2001, 10:53 AM
Hi, make sure that what you are displaying is what you are actualy doing, i.e. the angle you are looking at is the same as the angle you are moving at. Make sure your trig is correct, when I made my first opengl app it was a flioght sim and similar things happened to me. nehe's tutorial 10 shows you correct movement on the xy plane and can easily be adjusted to give 6 degrees of freedom (just remember the starting shapes of the sine/cosine curves etc.)
To roll the aircraft you rotate it around the z axis after (always rotate around the x, then y and then z axis). To implement this it would depend on your engine. Is it 1st or 3rd person? 1st person is easy simply rotate by your roll angle after you've rotated about your x axis then z axis.

Tim

01-05-2001, 03:52 PM
you actually are moving backward...check the order that you do your glRotate and glTranslate commands...different orders affect what you're looking at differently...