I've been trying to get a MD3 loader to work for awhile now. With help from goussej I got the loader to load all the geometry, surfaces, skins, and tags. I now, however, found a new issue that I am not quite sure how to tackle.

the MD3 model format stores it's rotation matrix as a 3x3. The generic model format I use in my game uses euler angles for rotations (before sending it to the shader), expressed like this:

1 2 3
| Matrix4f.rotate((float)Math.toRadians(modelAngle.z), new Vector3f(0, 0, 1), modelMatrix, modelMatrix); Matrix4f.rotate((float)Math.toRadians(modelAngle.y), new Vector3f(0, 1, 0), modelMatrix, modelMatrix); Matrix4f.rotate((float)Math.toRadians(modelAngle.x), new Vector3f(1, 0, 0), modelMatrix, modelMatrix); |

So, to try to break down the 3x3 matrix to euler angles, I did this:

1 2 3
| rotX = (float) Math.toDegrees(Math.atan2(tag._axis.m21, tag._axis.m22)); rotY = (float) Math.toDegrees(-Math.asin(tag._axis.m20)); rotZ = (float) Math.toDegrees(Math.atan2(tag._axis.m10, tag._axis.m00)); |

This doesn't seem to work quite right, and matrices are not my strong suit.

I will point out that the Z axis is used for height in my engine (instead of the Y axis).

Any ideas? :x