   2D rotation question (orbiting entities)
  Dang, I've been chock full of questions lately!  But this question would be easier to ask if I showed you my code of which to reference while you ponder my programming predicament...if (Ship->entFlags & FLAG_ORBIT){int Parent;float xn[3], yn[3], zn[3];float xo[3], yo[3], zo[3];// This is the orbiting ship's parent entity number.Parent = Ship->entParent - 1;// orbitValue and orbitSpeed are used to gauge how fast this entity orbits// on each of the x/y/z axes of rotation.  frameTime is how much time has// elasped between the last frame iteration and this one.Ship->orbitValue[0] = Ship->orbitValue[0] + (Ship->orbitSpeed[0] * frameTime);Ship->orbitValue[1] = Ship->orbitValue[1] + (Ship->orbitSpeed[1] * frameTime);Ship->orbitValue[2] = Ship->orbitValue[2] + (Ship->orbitSpeed[2] * frameTime);// First, input the orbiting entity's 'offset' value, of which to base its// orbit calculations (this is simply the distance from the 'parent' ent)...Ship->newLoc[0]= Ship->pOffset[0];Ship->newLoc[1]= Ship->pOffset[1];Ship->Zval= Ship->pOffset[2];// Rotate on the 'z' axis (rotate in a circle)Ship->newLoc[0] = (float)( (Ship->newLoc[0] * cos(Ship->orbitValue[0])) - (Ship->newLoc[1] * sin(Ship->orbitValue[0])) );Ship->newLoc[1] = (float)( (Ship->pOffset[0] * sin(Ship->orbitValue[0])) + (Ship->newLoc[1] * cos(Ship->orbitValue[0])) );// Rotate on the 'y' axis (oblong)Ship->newLoc[0] += (float)( (Ship->newLoc[0] * cos(Ship->orbitValue[1])) - (Ship->Zval * sin(Ship->orbitValue[1])) );Ship->newLoc[0] *= 0.50f;Ship->Zval = (float)( (Ship->pOffset[0] * sin(Ship->orbitValue[1])) + (Ship->pOffset[2] * cos(Ship->orbitValue[1])) );// Rotate on the 'x' axis (oblong)Ship->newLoc[1] += (float)( (Ship->newLoc[1] * cos(Ship->orbitValue[2])) - (Ship->Zval * sin(Ship->orbitValue[2])) );Ship->newLoc[1] *= 0.50f;Ship->Zval += (float)( (Ship->pOffset[1] * sin(Ship->orbitValue[2])) + (Ship->Zval * cos(Ship->orbitValue[2])) );//  Plug the rotational calculationsinto the orbiting ship's new//  location (newLoc), and add this into the Parent ship's current location.//  This will put this entity in orbit around the Parent ship!Ship->newLoc[0] += DXEnts->SpriteGroup.quadInfo[Parent].newLoc[0];Ship->newLoc[1] += DXEnts->SpriteGroup.quadInfo[Parent].newLoc[1];}This is the 'orbit' code for my 2D game.  I'm trying to write some code that will allow an entity (Ship) to orbit another entity (Parent) along all its local rotational axes.  The above code almost works, in that if I remark out the 'x' or 'y' rotational code then the Ship entity orbits the Parent along the two remaining axes just fine (z/x or z/y).  But if all three axes are used, then the orbiting Ship rotates in a chaotic fashion (sometimes orbits fine, sometimes collides with Parent as it flies in a Figure 8 fashion, etc).Would any of you help me to get my code straight?  I'll post more if you need any more information.  Thanks!   
  If you try to rotate around more than one axis simultaneously, crazy things happen. An orbit should be defined by an axis (not necessarily aligned with a coordinate system axis) and a radius, for a circular orbit anyway.Also, you're projecting a 3D orbit into a 2D game-space, and the details of how you do that will affect the display of the orbit.   