**Question**by CRiess · May 11 at 04:37 PM · transformconversioncoordinate-systemmatrix4x4.trsright-hand

# Changing a Transform matrix from right handed to left handed

I have the following question: I have and external DLL, which calculates Transform data (Translation, Rotation and Scale) in a right handed coordinate system. To be precise, the y-coordinate goes up, the z-coordinate comes out of the screen, and the x-coordinate goes to the left, relative to the z-coordinate. I want to convert this data to the left-handed coordinate system of Unity, where the y-coordinate goes up, the z-coordinate goes into the screen and the x-coordinate goes to the right, relative to the z-coordinate. Please see the attached screen shot, x is red, y is green and z is blue. For converting from one coordinate system, the z-axis has to be flipped.

I am currently using the following logic: The original data matrix:

[M00, M01, M02, M03]

[M10, M11, M12, M13]

[M20, M21, M22, M23]

[M30, M31, M32, M33]

Becomes the following matrix in Unity:

[M00, M01, -M02, M03]

[M10, M11, -M12, M13]

[-M20, -M21, M22, -M23]

[M30, M31, M32, M33]

It works fine. But the problem is, that I don't know why. The code was written by my predecessor, but I have to verify, that it works in all cases. The negation of M23 makes sense, as this is the z-component of the translation. But why are M20, M21, M02, and M12 negated? I am sure, that it has to do with the rotation, but I don't know enough about matrix mathematics to tell, why this is correct. Does anyone of you know, why this is working?

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.