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[16];
…
FVector X(matrix[0], matrix[1], matrix[2]); // OpenGL X
FVector Y(matrix[4], matrix[5], matrix[6]); // OpenGL Y
FVector Z(matrix[8], matrix[9], matrix[10]); // 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?