I have the following matrix in a game I'm reverse engineering to see how it works.
I managed to capture this matrix when a model is rendered:
0.999971, 0.003148, -0.006994, 0.000000
0.000000, 0.911863, 0.410494, 0.000000
0.006903, -0.410485, 0.911844, 0.000000
-25014.388672, 11944.956055, -19475.357422, 1.000000
I started calculating the angle using the following:
Point CalculateRotatation(float ModelView[16])
{
Point Result;
Result.X = atan2(ModelView[9], ModelView[10]) * (180 / PI);
Result.Y = atan2(-ModelView[8], ModelView[9]) * (180 / PI);
Result.Z = atan2(ModelView[4], ModelView[0]) * (180 / PI);
return Result;
}
I was following: http://db-in.com/blog/2011/04/cameras-on-opengl-es-2-x/
I'm not sure if I'm doing it correctly. The game does not using OpenGL-ES but I'm not sure that it matters.
Can any of you tell me if I'm on the right path or if my Calculate function is correct? The Y-value seems to be wrong. I know there are many threads like this and I looked through them but they don't seem to be doing what I have. They are using dot products and cross products. I just need confirmation or a little help.
EDIT: I know this much:
I know the calculations for the X and Y rotations are correct. If I change my character's view from left to right, the Z increases/decreases. If I change my character's view height, the X increases/decreases. The Y however I don't know if it is right or how to get it.. I have this diagram: