I am importing my animation keyframe joint data from Blender to my game engine. The joint data is a set of 4D matrices. Things are looking good except a remaining issue where the animation is facing the opposite direction than expected.

The matrices are column major, left handed coordinate systems. Y is up. I essentially need to reflect all the joints on the the Z axis. A rotation around the Y axis will not be enough because there are translation transformations that need to be mirrored as well.

Edit: I am looking for the math on how to do this in the engine and not from Blender.

  • \$\begingroup\$ I believe you are asking how to do this in Blender, is that right? - I guess you could do the transformation in your engine. \$\endgroup\$
    – Theraot
    Commented Oct 4, 2017 at 20:32
  • \$\begingroup\$ sorry, this is asking for generic math way to do in engine. \$\endgroup\$
    – kevzettler
    Commented Oct 4, 2017 at 21:49

1 Answer 1


To get a transformation matrix equivalent to the one you have, but reflected across a major axis you can compose it (multiply it by) a reflection matrix.

That is, if you have your input matrix M and you multiply by a matrix N that has the reflection.

To create the reflection matrix based on the major axis, you take the identity matrix and flip signs depending on the reflection you need.

You say you need to mirror the transformation on the Z axis, I understand this as reflecting against the XY plane. In other words, both X and Y values stay the same but Z is mirrored. That means that you will flip the sign of the 1 for the Z axis.

For clarity:

//                            x  y  z
                            _            _
                           |  1  0  0  0  |
                           |  0  1  0  0  |
Matrix_Mirrored_On_Z = M * |  0  0 -1  0  |
                           |_ 0  0  0  1 _|


  1. * denotes matrix multiplication.

  2. As said above, the shown matrix keeps X and Y values the same, and flips Z. If that is not what you want, I hope you can build the matrix you need using this explanation.

  3. As you would expect, composing the reflection matrix twice should give you back the original.

  4. I have not taken translation into consideration. The reflection matrix is intended to mirror across the XY plane (Z = 0). If need to mirror a translated object, you may want to undo the translation, mirror and translate again, in doing so the object will keep its location while being flipped on the Z axis.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .