   quick matrix question
  Okay, I'm fairly sure that I've asked this before and just forgotten the answer.Just say I have a 4x4 rotation matrix.Matrix m = x_rot * y_rot * z_rot;Matrix m2 = x_rot_2 * y_rot_2 * z_rot_2;Matrix final = m * m2;Where the "x_rot", "y_rot" vars are all rotation matrices for that axis.Will this get me the proper rotation? I mean the same that this would get me?Matrix final = (x_rot * x_rot_2) * (y_rot * y_rot_2) * (z_rot * z_rot_2);
  no, that won't work.Matrix multiplication is associative, meaning A*(B*C) == (A*B)*C, for all matrices A,B,C... but it's not commutative so you can't change the order in which the multiplication take place. E.g. -in general- A*B != B*A for all matrices A,B.If the matrix multiplication was commutative, then what you say would be true, since: xRot1*yRot1*zRot1*xRot2*yRot2*zRot2 == xRot1*yRot1*(zRot1*xRot2)*yRot2*zRot2 == xRot1*yRot1*(xRot2*zRot1)*yRot2*zRot2 == xRot1*(yRot1*xRot2)*zRot1*yRot2*zRot2 == xRot1*(xRot2*yRot1)*zRot1*yRot2*zRot2 == xRot1*xRot2*yRot1*(zRot1*yRot2)*zRot2 == xRot1*xRot2*yRot1*(yRot2*zRot1)*zRot2 == xRot1*xRot2*yRot1*yRot2*zRot1*zRot2 but it's not!In 3d graphics a simple example would be this: Imagine a translation matrix T that moves an object to a predefined spot, and a rotation matrix R that rotates constantly around Y.The left-multiplication with (T*R) would force an object to rotate around Y axis through its center, and would then position it to the spot.The multiplication with (R*T) however, would translate it to the spot (in its original orientation) and THEN rotate it around an axis Y that passes through the origin of the coordinates' system, (thus forcing it to plot a horizontal arc around the origin), which is clearly a whole new different effect!I hope this makes it clear.   ;  The order of multiplication can't change. What you get with m * m2 is equivalent to this:x_rot * y_rot * z_rot * x_rot_2 * y_rot_2 * z_rot_2;