How to convert a rotation matrix from a coordinate system to Unreal's coordinate system

Basically, I have a rotation matrix given in one coordinate system (OpenGL, to precise, which I think it’s right-handed and it has the Y axis pointing up), and I’d like to have the same rotation in Unreal’s coordinate system.

Does someone have faced a problem like this? I’m struggling with the math behind it, but I’m getting nowhere at all!

One solid way to do this, is by getting the source matrices values (as text/printing out) then doing the same with what would be unreal’s coords. say if you were to rotate an identity matrix around x in some other coordinates system you could see which numbers change when that happens in both coordinate systems, then do the same with y and z.

Unless its a very odd coordinate system, identity should always be the same, where the rows and columns have 1 when their index is shared and zeros otherwise.

The thing that can be complicated after that is understand the order engines may do the rotations in (unless dealing with quats)

Hope this helps

Thanks for the help, but I managed to get it working like this. I needed to apply a matrix, this one:
1 0 0
0 0 1
0 1 0

In code it’s something like this:



FMatrix mat = FMatrix::Identity;

mat.M[0][0] = 1, mat.M[0][1] = 0, mat.M[0][2] = 0;
mat.M[1][0] = 0, mat.M[1][1] = 0, mat.M[1][2] = 1;
mat.M[2][0] = 0, mat.M[2][1] = 1, mat.M[2][2] = 0;

rotationTranslationMatrix = mat * rotationTranslationMatrix * mat;


In case anyone with a problem like this wanders by this topic, I’ve also written a post on Stackoverflow, in which I wrote the solution with some more comments (the question I asked was a bit different, but the outcome is the same).