# Mysterious driver behaviour

I’m working on a geared mechanism, and I can’t get the rotation I want. I’ve replaced all rotation constraints with drivers, but one rotation flips through 180 degrees for no reason I can fathom.

In the attached blend it happens between steps 148 and 149. MoonArbour flicks through 180 even though it is driven by MoonContrateGear which continues to rotate smoothly. I can’t find anything special about that step. Any clues about why this is happening, and how to fix it, would be welcome.

antikythera-minimal.blend (1.1 MB)

This is the magic of Eulers. They seem intuitive but it’s all a giant lie. The rotation depends on all three channels even when you think it doesn’t.

Try this. Parent two empties to MoonCentralGear 20. Clear parent and keep transform for each, one at frame 148, one at frame 149, and you’ll see the true transform values-- which are not at all what you keyframed for the gear. Or rather, not what the driver is showing you. (It jumps from 135/0/135 to -44.1/180/44.1)

There’s not a one-to-one correspondence between -180,180 Eulers and actual orientations. There are actually twice as many Eulers as orientations. Blender “cleans” these Eulers so that they exist in a single space that can be mapped one-to-one to orientations.

By telling Blender that you want a transform channel, you’re getting these cleaned values. You can instead tell it you want to drive from your actual, uncleaned transform by driving from a single property, rotation_euler[0], to get x rotation, rotation_euler[2] for z rotation.

That’s the best solution here, because eventually, you want to input a value like 1800 into your eulers and see it rotate 5 times, and if you’re dealing with these cleaned eulers, that won’t work.

But another solution here would be to split up your transforms so that nothing every rotated in anything other than a single axis. XYZ eulers with 0 Y, 0 Z have the same raw and cleaned values.

bandages has the correct solution for you. But to add to the mystery, I have found that if you keyframe a base unit like you have and THEN put the driver on a chain of drivers down the line, it starts the chain at the value of the keyframed base which I think was around 45. So it takes your rotation and adds 45 to it. This doesn’t happen all the time but it does cause weird flips. It has a mind of its own.

That works perfectly. Thanks for your help - and thanks especially for taking the time to explain it to me, bandages. I have not only got my model working, but I now understand more.