   Camera/Quaternion problem ( and thanks NewDeal! )
  Heya, just getting back into the swing of things here, and writing my own Camera class.  Got quaternions working with it, but I've got a strange problem...In my code, I call cam.Yaw(1.0f) which changes the yaw of the camera by 1 degree.  Unfortunately, it doesn't rotate enough - although it does rotate - and by the time the camera reaches 360*, it has only rotated slightly more than 20* (guessing) before "resetting".  I'm afraid it's harder to explain than to show, so here is my code for the camera: void CAMERA::SetPosition(float x, float y, float z) {position.x = x;position.y = y;position.z = z;}void CAMERA::Yaw(float degrees) {const float theta = degrees / 57.295779513260928129089516840402f;tempQuat.EulerToQuat(theta, 0, 0); //praw etc are amounts gotten by keyboard inputtempQuat.MultQuat(&rotQuat); //rotquat = rotation quaternion. RotQuat. Thats a damn good variable name.rotQuat = tempQuat;}void CAMERA::Pitch(float degrees) {const float theta = degrees / 57.295779513260928129089516840402f;tempQuat.EulerToQuat(0, theta, 0); //praw etc are amounts gotten by keyboard inputtempQuat.MultQuat(&rotQuat); //rotquat = rotation quaternion. RotQuat. Thats a damn good variable name.rotQuat = tempQuat;}void CAMERA::Roll(float degrees) {const float theta = degrees / 57.295779513260928129089516840402f;tempQuat.EulerToQuat(0, 0, theta); //praw etc are amounts gotten by keyboard inputtempQuat.MultQuat(&rotQuat); //rotquat = rotation quaternion. RotQuat. Thats a damn good variable name.rotQuat = tempQuat;}void CAMERA::SetUp() {glLoadIdentity();rotQuat.toAxisAngle(result);glRotatef(result[0], result[1], result[2], result[3]);glTranslatef(position.x, position.y, position.z);}Quat Code, laborously taught by NewDeal Any guesses as to why it does not rotate as much as it should?[edited by - SkyFire360 on February 17, 2004 11:30:30 PM]
  I''ve no idea about quaternions, but it seems you are working with angles in radians all the time. However, glRotatef accepts only angles in degrees.Try multiplying your rotation angles (which I suppose are result[1], result[2] and result[3]) in the glRotatef-line by180/PI = 57.29578.;  You know... it''s really funny how one can miss small details like that... thanks Lutz! ;  npBut of course result[0] is the angle and 1,2,3 is the axis. 