   Tracking an Object's Movement
  I have an object following an orbital like path using the following code, which is a part of my drawWorld function:glPushMatrix();glRotatef((GLfloat)CurPos, 0.0,1.0,1.0);glTranslatef(-1.2,0.0,0.0);glRotatef(90.0,0.0,1.0,1.0);glScalef(0.1,0.1,0.1);s1.draw();glPopMatrix();The variable CurPos is set using a timer callback based on 360 degrees of rotation, so that the object will orbit the coordinates 0,0,0 at -1.2 units from the x-axis. The variable s1.draw() simply draws the object, which is centered at (0,0,0) before it is translated.I now have this object moving and I want the ability to have a camera following the object in its circular motion. The camera would only need to look at (0,0,0), but the actual camera position would have to move with the object. For my viewport I would need code that resembles the following (which I have in my displayCallback function):glViewport(291,25,198,198);glMatrixMode( GL_PROJECTION );glLoadIdentity( );glOrtho( -ratio, ratio, -ratio, ratio, 1, 256 );glMatrixMode(GL_MODELVIEW);glLoadIdentity();//Some Code to update the object which I want to follow''s//x,y,z coordinates, add +0.1 so that I am outside of the object.gluLookAt(objX+0.1,objY+0.1,objZ+0.1,0.0,0.0,0.0,0.0,0.0,1.0);drawWorld();I have attempted to use gluUnPorject() rather unsucessfully, the way I tried it was to save the states of the modelview matrix and the projection matrix right before I draw s1, and then get the viewport matrix before I set the gluLookAt and the use the values from gluUnProject to be objX, objY, objZ.My code from was gluUnProject(0.0,0.0,0.0,model,proj,view,&objX,&objY,&objZ). The values I got did not do much good for me in following the object. I couldn''t actually follow what the values were doing, so I am sure I am doing something wrong with this.In an effort to make the long post short, what would I need to do in order to follow the motion of the object s1? Any ideas would be very helpful!Thanks a lot.-Dan- 
  glUnProject isnt what your looking for.What is the problem exactly? You dont know the world coordinates of the object?If thats the case, just keep track of how much you move the object each frame (translations and rotations) eithe by using simple variables or a matrix which ever best suits what your doing, that way you will know where it is.Then simply call gluLookAt with the location of your object and the origin as the direction.Sorry if I'm no help.   [edited by - code_evo on February 5, 2004 11:13:06 AM];  The problem is that I know what my transform is:glRotatef((GLfloat)CurPos, 0.0,1.0,1.0);glTranslatef(-1.2,0.0,0.0);Which is the actual transformation of the object. I am not sure now, how I need to set up the camera so that it will follow the object through its transformation.I think my problem might be the math? 