Limit Driver rotation

Hi

Feel like this should be an easy thing but getting a little stuck, Drivers are a bit of an unknown territory for me

So I have a driver set up so that object A rotation on the y-axis is determaned by object B’s location on the X axis

Using this expression: " var/90*20 "

This works fine, however, it rotates on a 360 I want to limit that so that when it reaches a certain rotation on a positive Y rotation it stops and on a negative y rotation it stops.

I tried a Limit Rotation Constraint, which kind of works but jumps back to max rotation as it still thinks it’s doing a 360

Hopefully That all makes sense.

If you have any further questions I’m happy to answer

Thanks for any help in advance

You want to use max(a,b) and min(a,b) Python functions here.

If that’s the case, then you want to run the max and min on var. As an example, max(min(var, 720), -720) will return the lowest of var and 720 (clamping the upper bounds to 720) and then return the highest of that and -720 (clamping the lower bounds to -720.) You would use that expression in place of “var”, so your full expression would look like (max(min(var, 720), -720))/90*20.

1 Like

Worked, Thank you so much. really appreciate it!