   Getting position of object after rotation
  I have an object orbiting around a sphere (on an angle). I'm using simple trig to get the position of the object. In the actual draw function, I first call glRotate along the Y then Z axises (to properly position the word) and then translate the ship to it's final position using the precalculated position values (which I recalculate after every frame).What I want to do is move another item to the exact position of the object at a certain frame. At this point, I'm looking at the easiest way to get this done without having to do any major overhauls of my code (I need to get this project out of the way).Think of this new object as a missile. I want the missile to be placed from the orbiting object at which point it'll move towards the origin of the screen (0, 0, 0) which is easy enough to do. I need to check for collision on the way however, which is why I need to know the actual position of the orbiting object in world coordinates (so I then move the missile to that position and start the animation).Is there are way to achieve this using the setup described above.   
  Well, normally you'd store the object's world matrix (or orientation and position) somewhere, so you could just read it. If you don't, you might do this:1. Read the current modelview matrix using glGet and eliminate the translation part if necessary.2. Use the precalculated position value and apply the rotation matrix from step one appropriately.You should now have the needed position. If not, maybe you could post some code and show us what you're actually doing.   ;  Could you elaborate on this? I'm a bit confused as to how to go about it. I do calculate the orbitter's position at each frame in relation to the earth, but then perform a couple of glRotates before translating it to get it into it's final position. This is the value I need to generate.So I have a 3d array storing position that is updated using simple trig and then two stored rotation values (one on the Y and one on the Z axis) are used to rotate the object to it's final position.With this is mind, when would I use your method? Doesn't the modelview matrix stored the view as well which would mean that I can't use it to get the value for the object in world coordinates. Assuming that I can, how could I go about it. Also, what can I do to eliminate the translation (and why would I want to?) and apply the rotation?Sorry, this is confusing. I'd generally post the code, but this is part of a project from university making me hesitant to do so.   ;  Well, you should definitely read more on matrix math. Here's the OpenGL FAQ.Generally glRotate and the like generate a 4x4 matrix which is postmultiplied to the current matrix (which in most cases is the modelview matrix). Thus, if you call glVertex the given vertex position is transformed by the current modelview matrix.You already seem to get your final position by multiplying with the modelview matrix, so unless you didn't set the view part (i.e. no view transformations) you already get the result in eye space rather than world space.You have several options, but maybe the easiest one (in your situation) would be to do the glRotate calls at the beginning of the frame, before doing the view transformations, i.e.glIdentity();glRotatef(...);...and get the resulting rotation matrix using glGet. Then use glMultMatrix to add the result of your glRotate calls to the modelview matrix, draw your objects and also use the rotation matrix to transform your vector to get the final position (needs some matrix/vector math by yourself).The translation part of the 4x4 matrix might be irrelevant, depending on whether you want to apply the rotation only or the complete transform. Since you want to get a position as calculated by OpenGL you'd need to leave the translation part in, so forget about that.Last but not least, I'd like to repeat my initial advice: get yourself familiar with matrix and vector calculations. Since OpenGL (as well as D3D) is based on this, you'll make your life much easier, if you have a basic understanding of what's going on.   ;  Thanks for that. I seem to have gotten it semi-working. There's only issue to deal with.Go calculate the position of the orbiting object, my code is:glPushMatrix();glLoadIdentity();glRotatef(orbittedObject->getRotationY(), 0, 1, 0);glRotatef(orbittedObject->getRotationZ(), 0, 0, 1);glTranslatef(position[0], position[1], position[2]);glGetFloatv(GL_MODELVIEW_MATRIX, matrix2);glPopMatrix();In my missile constructor, to get the position, I use:GLfloat* mvMatrix = startObject->matrix2;if (mvMatrix != NULL){    double x = (mvMatrix[0] * startObject->getPositionX()) + (mvMatrix[4] * startObject->getPositionY()) + (mvMatrix[8] * startObject->getPositionZ());    double y = (mvMatrix[1] * startObject->getPositionX()) + (mvMatrix[5] * startObject->getPositionY()) + (mvMatrix[9] * startObject->getPositionZ());    double z = (mvMatrix[2] * startObject->getPositionX()) + (mvMatrix[6] * startObject->getPositionY()) + (mvMatrix[10] * startObject->getPositionZ());    position[0] = x; position[1] = y; position[2] = z;}(where startObject is the object from the first code example)Anyway, the issue I'm having is that this only seems to work correctly when the ship is in the right portion of the screen (i.e. x is positive). For the other positions, the missile isn't being located to the exact position of the object. Any ideas why this is occurring?   ;  Well, it might be an issue with the view part of the model view matrix. Without some more code it's hard to say.Additionally, you don't need to calculate the starting position of the missile yourself if that position is the same as the position of the orbiting object. You could just read that position from matrix2 ([12],[13],[14] if I'm not mistaken, otherwise [3],[7],[11]).   