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.