Matrix and rotation

Hello,

how do i set the x and z rotation from a rotation matrix to zero?

or how do i get the rotation for each axis?

https://wiki.jmonkeyengine.org/legacy/doku.php/rotate

i want to get the rotation for a axis.

something like Vector3f rotations = matrix.getRadians();

I’m not terribly good with this topic, but I’m guessing you could take the matrix and make a Quaternion from it. Like:



Quaternion q = new Quaternion()…fromRotationMatrix(yourMatrix);



And from there you could do:



float[] angles = q.toAngles(null);



And that would store the angles on each axis. I’m not sure what data you need, but if you need a particular rotational column, take a look at .getRotationalColumn(int i) - on Quaternions. That will return one specified axis as a vector.



I dunno if any of this helped but those are the methods I’m constantly slinging around to get rotations XD



Good Luck!

~FlaH