Original Post
Hi to all. This is my first post:) I have defined three function that calculate the rotation around the x axis, the y axis and traslation. Then i use this functions to compute the parameters to paste to glulookat. No problem with traslation, but when i use the two rotation simultaneously the camera doesn't work fine. In fact it rotate olny arount the y axis. But when i use only one rotation it works fine. Why? Tnx to all. There are the functions: // translate camera void MoveCamera ( FVector3D Direction ) { Position = Position + Direction; } // rotate around x void RotateCameraX ( GLfloat Angle ) { RotatedX += Angle; //Rotate viewdir around the right vector: ViewDir = (ViewDir*cos(Angle*PIdiv180) +UpVector*sin(Angle*PIdiv180)).NormalizeFVector3D(); //now compute the new UpVector (by cross product) UpVector = (ViewDir^RightVector)*-1; } // rotate camera around y void RotateCameraY ( GLfloat Angle ) { RotatedY += Angle; //Rotate viewdir around the up vector: ViewDir = (ViewDir*cos(Angle*PIdiv180) - RightVector*sin(Angle*PIdiv180) ).NormalizeFVector3D(); //now compute the new RightVector (by cross product) RightVector = ViewDir ^ UpVector; }