Update: Included a jsfiddle for clarification:
I am working with an object (a cube) in a scene and my objective is to provide it with 3 angles that represent its orientation in the real world. These angles are measured against the X, Y, and Z axes. Unfortunately, I am struggling with how to assign these angles to the object and then update them as new data is received. It seems that when I set initial angles everything works fine, but when I try to set new angles, they seem to be relative to the object's local space rather than the world space. While I have looked at similar questions on this topic, most of them focus on rotating objects around an axis rather than setting explicit angles against the world axis.
Currently, when one of my x, y, or z angles changes, I use the following code:
cube.rotation.set(x, y , z, 'XYZ');
To provide a visual example, here is a screenshot of my cube...without changing X or Y, I rotate it by 90 degrees about Z axis. See the before and after images below:
https://i.sstatic.net/FmJr0.png
and
https://i.sstatic.net/SavFe.png
You can see how the rotation has occurred around the normal direction of the purple face rather than the world Z axis...
This issue has left me puzzled and frustrated. :-(