I need to have one object duplicate the rotation of another, with the following complications:

There is Object A, which may be rotated through various, arbitrary methods, such as animation, physics, etc. There is also Object B, which must imitate Object A’s rotation.

If it was that simple, I could just take Object A’s rotation change and rotate Object B with it. However, Object B may have axis-based limitations: it may, for example, only rotate around the X and Y axes, and only rotate at half a speed around Y. (The axes themselves are constant, for example world axes, or axes of an unmoving parent, so when it comes to these limitations, the axes won’t rotate with the objects.)

The problem is that I can’t break a Quaternion into axis aligned components in order to apply the limitations. I’ve also tried Euler Angles, but the way Unity breaks the Quaternion into Euler Angles seems arbitrary, so just setting eulerAngles.z = 0 will mess things up.

Intuitively, this seems like a simple thing to do, but I can’t figure it out. Can anyone help?