3

I want to set a min and max influence range using a driver for the copy rotation constraint. I've tinkered with the driver graph in graph editor but it's too delicate to set my specific range --between 0.499 and 0.97. So when I manipulate the target object in the scene--a slide control bar--up and down, it sets the copy rotation influence between 0.499 and 0.96. The default range is between 0.0 and 1.0 when I slide the control bar targeted by driver.


This is graph editor screenshot with scripted expression from answer. Driver holds influence value at 0.499 but does not increase to 0.96 when targeted slide control is moved along Z axis

Dino 808
  • 31
  • 3
  • Would look into why there is an ERROR message --> https://blender.stackexchange.com/questions/46899/python-auto-execution-disabled-error and whether this could be effecting your result. – batFINGER Jul 05 '21 at 14:50

1 Answers1

6

You can use a scripted expression, using min() and max() functions.

Let's say you're driving this from the Z position of an empty, the variable for which is named var.

Then if you use an expression like "min(0.96, max(var, 0.499))" then you will get 0.96 if var is greater than 0.96 (because the minimum value of the two is 0.96), 0.499 if var is less than that (the maximum of the two values), and var if var is in between those two values.

enter image description here

It's also possible to do this by editing the driver curve, using vector handles for the controls, but I just use scripted expressions for this kind of thing.

Nathan
  • 24,535
  • 1
  • 22
  • 68
  • Wow, thanks for quick answer especially on 4th of July! I copied and pasted expression into scripted expression field (I'm using v2.79 btw). Influence sets at 0.499 but does not change when I move slider control. Am I doing something wrong? – Dino 808 Jul 05 '21 at 06:34
  • I can upload a screenshot of blender control panels if you tell me how...sorry – Dino 808 Jul 05 '21 at 06:41
  • @Dino808 I couldn't tell you without seeing a file or picture. You can edit your question and copy/paste an image with your cursor in the edit field to upload a pic to SE. – Nathan Jul 05 '21 at 06:47
  • I had to answer my own question to paste screenshot above. – Dino 808 Jul 05 '21 at 07:35
  • Looks like moderator moved screenshot to original question post – Dino 808 Jul 05 '21 at 11:30
  • @Dino808 Look at the error message in your driver tab. You have Python disabled. You can enable this in user preferences/save & load/blend files/autorun Python scripts. – Nathan Jul 05 '21 at 15:39
  • Wow that did the trick...works! Thanks Nathan..hope u can enjoy the rest of ur long 4th weekend! – Dino 808 Jul 05 '21 at 16:53