Hi I have an arbitrary rotation quaternion, which is constructed from a series of operations done by the user (they select the object, rotate it around the plane constructed from the camera view direction, then maybe rotate it from another angle etc).
I then need to decompose this rotation object down into a rotation around the X, Y and Z axes. Note that it doesn't have to be that order. The user interface allows a user to attach rotation blocks together in any order, so they could chain them up like this:
In code, I then loop through each block and do:
finalRotation *= Quaternion.CreateFromAxisAngle(blockAxis, toRadians(blockAngle))
So how could I convert an arbitrary quaternion back to this block representation? I've tried projecting the quaternion onto the X, Y and Z planes as per this answer:
Component of a quaternion rotation around an axis
and then connecting up the blocks in an [X][Y][Z] order, but so far the results seem to come out incorrectly. Would someone be able to explain how I should approach this problem? Note I am restricted to rotating around one axis at a time, per block.
Edit: To clarify I am using the MonoGame framework, not Unity.

Quaternion.eulerAnglesandQuaternion.ToAngleAxis? One of them should work for you.System.Numericsnamespace, both for which I cannot seem to find any method to convert to Euler angles either. Have a look at my implementation if you want to use the same logic.ToEulerAngles()function doesn't account for gimbal lock so won't work for all angles, and yourGetAxis()function doesn't account for singularity cases either so you'll have problems when angle = 0/180.Quaternion.eulerAnglesmethod to see the code behind it and learn how its done?