# Converting OpenGL transform matrix to FRotator

I want to convert an OpenGL transform matrix into an FRotator.

I go about this by getting the base axis from the OpenGL matrix and using the UKismetMathLibrary::MakeRotationFromAxes, but I am not getting correct results:

double matrix;

FVector X(matrix, matrix, matrix); // OpenGL X
FVector Y(matrix, matrix, matrix); // OpenGL Y
FVector Z(matrix, matrix, matrix); // OpenGL Z

FRotator Rotation = UKismetMathLibrary::MakeRotationFromAxes(X, Y, Z); // Forward, Right, Up

This is clearly not working for anyting other than the identity matrix. When I sett the matrix to identity and getting X = 1,0,0 Y = 0,1,0 and Z = 0,0,1 for base axes this yields an FRotator with Pitch = 0, Yaw = 0 and Roll = 0, which is what I would expect.

What am i missing here?

UE4 has it’s own matrix implementation + it has some diffrent version of it if you look on refrence

In fact what function that you are using, just normalizeing vectors and make FMatrix out of it and then make FRotator out of it:

``````FRotator UKismetMathLibrary::MakeRotationFromAxes(FVector Forward, FVector Right, FVector Up)
{
Forward.Normalize();
Right.Normalize();
Up.Normalize();

FMatrix RotMatrix(Forward, Right, Up, FVector::ZeroVector);

return RotMatrix.Rotator();
}
``````

Maybe if you take it to FMatrix and it if you look on it’s function set it will let you move fearther with it. Personallly… i’m noob in matrixes, so other then that i can’t help you