   D3DXMatrixTransformation question
  Hi,I use D3DXMatrixTransformation to rotate an object around a specific point (since its a very easy function to use). I do the following:D3DXMatrixTransformation( &l_d3dmWorldMatrix, nullptr,nullptr,nullptr,&this->m_pWorldBound->GetCenterTransform()->GetPosition(),&l_d3dqRotation,nullptr );What I do not understand is that this function changes the translation part of the world matrix as well, but I'm not giving it any translation vector. I confirmed this by calling D3DXMatrixDecompose and checking wat translation output it gives me. As well as just looking at [4,0], [4,1] and [4,2] of the world matrix, one can see that the translation part of the matrix is changed. What is now extremely weird to me is that the object is still drawn in the correct location in the world even though the translation part of the world matrix changed and it rotates it correctly. Can anyone explain this to me? Thanks in advance!   
  It's handling moving the center of rotation to the origin before rotating, then moving back.   ;Quote:Original post by gekkoIt's handling moving the center of rotation to the origin before rotating, then moving back.Sorry, but Im not quite understanding what you are saying?EDIT: Ok, I got it now. So it translates the "Center of Rotation" to the origin, rotates the object en then translates it back.[Edited by - G-Man9566 on April 20, 2010 1:54:41 AM];  D3DXMatrixTransformation: Mout = (Msc)^-1 * (Msr)^-1* Ms * Msr * Msc * (Mrc)^-1 * Mr * Mrc * Mtwhere: Mout = output matrix (pOut) Msc = scaling center matrix (pScalingCenter) Msr = scaling rotation matrix (pScalingRotation) Ms = scaling matrix (pScaling) Mrc = center of rotation matrix (pRotationCenter) Mr = rotation matrix (pRotation) Mt = translation matrix (pTranslation)mat^-1 = Transpose/inverse of a given matrix, it effectively undoes a translation prior the actual rotation and translation.Removing the non rotation part away you get the following formula: Mout = (Mrc)^-1 * Mr * MrcThe first part (Mrc^-1) translates the points over your center of rotation.The second part (Mr) rotates the points.The last part (Mrc) translates the points back to its original position.I hope this explained it a bit better to you.Kind regards,Xeile;  Hey everyone, thanks for the help, I understand how it works now!   