My program moves an object with the mouse
After I rotate the camera the object moves but no longer in the direction of the mouse movement
I have this to rotate camera:
//change radius and zoom in/out with respect to the origin as mouse is moved vertically
rad += (mouseY-y)*.5;
//rotate the camera about the y-axis as the mouse is moved horizontally
thetaCam += (mouseX-x)4PI/180;
I do this to move object
//move object around the x-z plane of the scene
obj.x -= (mouseX-x).4cos(thetaCam) + (mouseY-y).4sin(thetaCam);
obj.z += -1*(mouseX-x).4sin(thetaCam) + (mouseY-y).4cos(thetaCam);
when I display I do this:
//display the object
... glTranslatef(obj.x,obj.y,obj.z); //draw object
After camera rotation, the object moves incorrectly with mouse.
Do I need to keep track of the camera x,y z coordinates?