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?
Hi! Did you find out a solution to this? ,Hi! Did you find out the solution?