   Object Rotations on Axis Help Please
  Gidday,I searched and found simular questions, but couldnt quite work it out with the answers given. Below is a snippit of code from a project of mine.I import a small box, and can move it in any direction, but when I come to rotating it on its Y Axis I get the following problem.If I construct the box, say,in an editor and have the axis at centre (0) co-ords, and I import it, it will rotate on its y axis, which is the present world 0.  Now the problem- If I move the box in the editor ie 2 units to the X, to allow placement on my "world" then load it into my project, it rotates in a large circle around the worlds 0 Y axis.I need it to rotate on its position in the world,and wherever it may get moved to.Could some one help me find a solution.void RenderB(void) {  D3DXMATRIX matWorldC;  D3DXMATRIX rot_x_matrixC;   //Our rotation matrix for the x-axis  D3DXMATRIX rot_y_matrixC;   //Our rotation matrix for the y_axis  D3DXMATRIX rot_matrixBC;//Final rotation matrix  D3DXMATRIX trans_matrixBC;   //Our translation matrix  static float Crot_x=0; //Tracks rotation for the x-axis  static float Crot_y=0; //Tracks rotation for the y-axis   Crot_x+=x_speedC;   Crot_y+=y_speedC;   //Notify the device that we''re ready to render if(SUCCEEDED(my_engine.BeginScene()))    { //Set up the rotation matrix for the Object   D3DXMatrixRotationY(&rot_y_matrixC,Crot_y);   D3DXMatrixRotationX(&rot_x_matrixC,Crot_x);   //Combine the 2 matrices to get our final Rotation Matrix   D3DXMatrixMultiply(&rot_matrixBC,&rot_x_matrixC,&rot_y_matrixC);   D3DXMatrixTranslation(&trans_matrixBC,x_posC,y_posC,z_posC);   //Build our final World Matrix   D3DXMatrixMultiply(&matWorldC,&rot_matrixBC,&trans_matrixBC);  //Set our World Matrix  my_engine.SetTransform(D3DTS_WORLD,&matWorldC );//Draw our cube g_boxB.DrawBox(); //Notify the device that we''re finished rendering for this frame } my_engine.EndScene(); }(Code Dos''nt Cut and paste here well  )Thanks for any helpTakeCareOldfella 
  try changing the order in which you multipy the matrices>> D3DXMatrixMultiply(&matWorldC,&trans_matrixBC,&rot_matrixBC);Also put source code inside source blocks ie[ source ]// Code here[ / source ];  Hi IFooBar,Thanks for your quick reply,though I have already tried changing that particular multiplication order.No luck, The box still rotates around the worlds 0 y Axis instead of its own centre in space.Any other Ideas would be appreciated, I know ive missed something simple TakeCare.Oldfella ;Matrix and Quaternion FAQ, Question 36You'll want to bookmark this one Use that method for combining rotations, then at the end, plug in your objects X,Y & Z coords...matObject._41 = fX;matObject._42 = fY;matObject._43 = fZ;Avoids matrix multiplication altogether. /*edit*/ but watch out for this.. /*edit*/ [edited by - matibee on August 3, 2003 5:06:19 AM];  Gidday matibee,Thanks for the link, the info is fantastic Should be every thing that I need and more.TakeCareOldfella. 