Problem with rotation

Hello guys,

I’m having a problem with a rotation:
I have a central arm called “rootbase.” This rotates along the z-axis. Attached to it is an “arm2” with a physics constraint that rotates along the y-axis with an add force. Then I have an arm1 that should mirror the movement (when arm2 rotates to the left, arm1 should rotate to the right and vice versa). The problem is that it glitches for a few microseconds when it’s at 90/-90 degrees. When printing the world rotation, I see that it goes from 0 to 89 and at -89 no further. Perhaps this could be the problem. The component hierarchies are a bit complex, so I can’t use the relative rotation. How can I fix this? I’ve attached the schematic and script.

Arm 2’s swinging when the base rotates works. Arm 1’s does too, but there’s that 90-degree teleport glitch I can’t seem to fix.

I don’t know what to do anymore, please help.

Root base rotation is running into Gimbal Lock. You need to convert the rotation to a Quat, do the calculation, then convert it back to a rotator, then set it.

I tried that procedure, but I can’t figure out how to make it work properly.

With this script, the arms are positioned correctly, but the problem is that arm 1 exactly copies the rotation of arm 2. Instead of rotating in the opposite direction. (Let me explain: if arm 2 rotates to the right, arm 1 also rotates to the right, but in reality one should rotate to the right and the other to the left, and vice versa.)