View Full Version : Rotation problem

06-28-2001, 03:10 AM
I am writing a software that can load and display 3D models and can pan, rotate and zoom.

I'm implementing rotation and translation in such a way that wherever I pan the object, it always rotates around the center of the screen(like it should) using rotation first then translation.

When i dont rotate or rotate the object around Y axis the object can pan right, left, up and down easily by simple geometric calculations.

The problem starts here.

when the object is rotated along the X axis or Z axis then I cant seem to figure out how to make the object pan on the screen in UP, down,left and right direction. I cant figure out how to use sin or cos for this....

I can make it move left and right but top /down starts having problem.

can anyone help me with this? Is my approach wrong and is there a better approach.

06-30-2001, 03:17 AM
Using sin and cos for what?
What is wrong with something like

glRoatate // set the angle to move object
glTranslate // move object
glRotate // rotate object around itself