In the Unity Editor sometimes when you rotate a object around the blue axis (i.e. the local Z axis using the blue circle) it modifies the local Y rotation of an object, sometimes it modifies the local Z rotation of the object. I understand that this is because of the way euler angles work where you can potentially have several euler angles for every one quaternion. It does however pose a problem for me.

I want to adjust an objects rotation to some value and then to set it’s rotation around its local blue axis back to what it was previously. The problem is that simply storing the local Y rotation or local Z rotation and setting it back to that doesn’t work because of the problem I highlighted in the first paragraph where Unity often flips between the two. So I guess my question is how do I solve this? How do I store the quaternion value around the local Z/blue axis and then set it back to it’s previous value?

I’ve been stumped for days so any help would be much appreciated!

Thanks guys