Subtracting two 4x4 matrices - is this possible?

I have two 4x4 OPENGL Matrices -

  • The 1st matrix contains the rotation and position of the object in frame 0.

  • The second matrix contains the rotation and position of the object in frame X;

I want to get the displacement of moving an object between frames 0 and X, is it (probably) enough if I just subtract both?

CMatrix4x4 offsetMatrix = matrixAtFrameX - matrixAtFrame0;

What I am doing is exporting a Bone frame transformation matrix, where this matrix is ​​the transformation offset between the animation frame 0 and the X frame.

  • Is it possible to subtract both matrices?

  • What are the results?

+3
source share
1 answer

You will need to multiply the matrix in frame x by the inverse matrix in frame 0.

matrixOffset = inverse(matrixAtFrame0) * matrixAtFrameX

This will give you relative conversion and rotation between frames.

+8
source

All Articles