Some Simple Questions about Matrix

I have the following two matrices:

    Matrix4x4 mat1;
    Matrix4x4 mat2;

I have have an object which needs to incorporate the following transformation:

  1. Rotation and translation part of mat1 and
  2. Rotation part of mat2;

How can i do that? I think just multiplication of two matrices won’t produce the desired result.

If any one has any suggestion, it will be highly appreciated.

Thank you in advance.

When you say “rotation part of mat2” do you mean that mat2 is just a rotation matrix or it holds a rotation, translation, and a scale and you just want to pull the rotation part out?

If it’s the former then yes, you just need to multiply the two matrices together. If not, you need to describe what’s in the two matrices as it makes a difference how easy it is to pull information out of them.

No, mat2 consists of rotation as wel as translation. But I only want to consider rotation and make the translation part to ( 0, 0, 0). But doing that I failed to get the desired result.

matrix 1 should be like this

r r r t
r r r t
r r r t
0 0 0 1

while matrix 2 should be like this

r r r 0
r r r 0
r r r 0
0 0 0 1

then the multiplication of the two matrix will “incorporate” the requested information. Now the only thing to clarify is what incorporate means and in witch order do you want to apply the transformation.

Thank you very much for your reply. By incorporate I meant the resultant transformation should possess the transformation of matrix1 as well it will also get the rotation of matrix2. I tried in the above mentioned way, but not getting the correct output. Is the order of matrices important. Actually to explain the matter a bit more: suppose I have object1 which when dragged or rotated, the it gets some tranformation (translation and rotation). I have also object2 which will also get the same transformation as that of object1; but in addition to that, it will also have its own rotation. So object2 will have the transformation of Object1(translation and rotation) as well as its own rotation.

Order is indeed important usually. Say for example you have two rotation matrices that rotate around some axis. Rotating by x degrees then rotating on that same axis by y degrees is the same as rotating by y and then by x, right? In that case order doesn’t matter. Another example, you rotate a box around the origin, then translate down the x axis. It will still be down the x axis, but will be spinning. If you reverse them, you move the object down the x axis and then you “orbit” it around the origin.

In the case you gave, object2 would want to spin on its own rotation first, then apply the transformation of object1.