I'm having a hard time setting up a driver to rotate my object based on the proximity of another object. I'd like to have multiple faces of an object rotate 180 degrees based on the proximity of a driver object. I have so far managed to get a simple 180 degree rotation working by using the expression:

max(0,min(pi,5-abs(distance))) with the distance variable being the distance between my driven object and my driver object

It's a problem however because once my driver goes over the driven object and the distance starts to grow again, it rotates back to the driven objects original rotation. I'd like for this rotation of 180 degrees to stay as I would like to do a procedural animation of walls changing colour without having to rotate each plane individually. I'm using drivers as I need to be able to bake the animation to keyframes so I can export the objects with the animation.

I hope I gave enough context :)


1 Answer 1


Try this:

max(0,min(pi,5-abs(distance))) if (yTorus - ySuzanne) > 0 else -pi

So only if yTorus (which is the y coordinate of my Torus) is bigger then ySuzanne (which is the y coordinate of my Suzanne) then i take your function. if this is not the case, i take a constant (in my case -pi).


enter image description here

driver settings:

enter image description here

Note: i took here the y coordinate as an example. Of course you have to adapt this to your needs. I don't know your special specifications because you didn't tell us all the details.

  • 1
    $\begingroup$ It works! thank you so much for such an informative answer, apologies that I didn't give all the details, this is my first question and I'm still learning how to post questions! Thank you for the fast answer to my question :) $\endgroup$
    – Zarbio
    Commented Sep 15, 2022 at 16:08
  • $\begingroup$ You are welcome! If my answer helped you, please click on the checkmark left of my answer! Thank you! $\endgroup$
    – Chris
    Commented Sep 15, 2022 at 16:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .