1
$\begingroup$

Driver and driven image

I've specfied my question so its hopefully a bit clearer. The idea is to use the rotation of a driver, to drive 12 driven objects. This means that for every 30 degrees of rotation, a driven object goes from 0, to 1 and back to 0. Gradually.

What does this specificly look like for one driven object?

Driver rotates to 15 degrees. Driven object is on Tz = 0 Driver rotates to 30 degrees. Driven object gradualy moved to tz = 1 Driver rotates to 45 degrees. Driven object gradually moved to tz = 0

Driver rotation can be > 360 and only when it reaches the equivalent of 15-45 degrees, should driven object gradually move from 0, to 1, and back to 0

$\endgroup$
5
  • 2
    $\begingroup$ What do you mean by "activates from 0 to 1"? Should they shift or rotate? Could you add some "before" and "after" images? $\endgroup$
    – lemon
    Commented Oct 1, 2020 at 14:06
  • $\begingroup$ Hi Lemon, Good point. When driver rotates to 0 degrees. The first driven bone would translate in z from 0 to 1. Then when driver rotates to 30 degrees. The first driven bone would translate back to 0, and the second driven bone would translate in z from 0 to 1. Does that help? $\endgroup$
    – Henk Kok
    Commented Oct 1, 2020 at 14:11
  • 1
    $\begingroup$ Yes, much more clear. Does the driven bones belong to the same armature? $\endgroup$
    – lemon
    Commented Oct 1, 2020 at 14:18
  • $\begingroup$ absolutely. And I've taken care of the driver creation itself, Its just that Im not really sure how to go about getting rotation converted to translation combined with not getting them all to go at the same time. sorry if this question isnt more clear. if it would be helpful I could make a blend file to give a clearer use case $\endgroup$
    – Henk Kok
    Commented Oct 1, 2020 at 15:58
  • $\begingroup$ Somewhat related blender.stackexchange.com/a/133920/15543 in that a single driver can be copied pasted that uses a custom prop of the objects. $\endgroup$
    – batFINGER
    Commented Oct 7, 2020 at 15:32

1 Answer 1

2
$\begingroup$

If you don't mind editing the drivers for every object individually its quit simple.

radians((LOWER_LIMIT <= (abs(degrees(var)) % 360) < UPPER_LIMIT) * 90)

with:

var = z rotation driver
UPPER_LIMIT = minumum rotation of driver to rotate object
LOWER_LIMIT = maximum rotation of driver to rotate object

How this works:

The comparisons return either a value 1 (True) or 0 (False)

NOTICE: for the modulo to work you have to anable Auto run python script.
And to make it work gradually (totates 360d):

radians(LOWER_LIMIT <= (abs(degrees(var)) % 360) < UPPER_LIMIT) * (abs(degrees(var)) % 360 - LOWER_LIMIT) * 6

And if you want it to rotate back in opposite direction:

radians((LOWER_LIMIT <= abs(degrees(var)) % 360 < UPPER_LIMIT) * (-(1 / 15 ** 2) * (abs(degrees(var)) % 360 - LOWER_LIMIT - 15) ** 2 + 1) * 90)

Completely unrelated:
-binary counter

radians( ( ( degrees(var) % 2**(Driven_Object_Number))>2**(Driven_Object_Number-1))* 90)

here it is counting to 128 binary counter counting to 128

$\endgroup$
12
  • 1
    $\begingroup$ And if you don't want to edit the drivers for every object individually, you can add a layer of indirection: drive an empty or something, and then use drivers or constraints from it to apply those changes to a large number of objects. (Constraints are the easiest, can use "copy constraint to selected bone/object" operations.) $\endgroup$
    – Nathan
    Commented Oct 1, 2020 at 20:25
  • 1
    $\begingroup$ you set it once, for the empty, to drive some value off it. Then for the rest of the objects, you can create simpler drivers without any script (like, by copy as new driver, paste as driver), or even better, use constraints to translate the action taken by the empty onto everything else. $\endgroup$
    – Nathan
    Commented Oct 1, 2020 at 20:36
  • 1
    $\begingroup$ @HenkKok, what do you mean exactly by shift between the two stages. like at 15 degree being true and at 0 and 30 false, or at 0 false and gardually going to true at 30 degrees? $\endgroup$
    – Alex bries
    Commented Oct 2, 2020 at 9:20
  • 1
    $\begingroup$ just one more question, do you want it to get back in oposit direction or do 360 flip: (radians(0) <= (abs(var) %(2*pi)) < radians(30)) * ((abs(var) % (2*pi)) - radians(0)) * 6 (this is the 360 flip) $\endgroup$
    – Alex bries
    Commented Oct 2, 2020 at 10:24
  • 1
    $\begingroup$ Hi Alex, I respecified the question to hopefully clarify things a bit. (see description on top) A 360 flip sounds cool, but basicly the driven object would ideally move from 0, gradually to 1, and back to 0 whenever the driver goes from 15 degrees, to 30 degrees and then to 45 degrees. Hope that makes sense. Thanks for helping out man. I could not do this without diving deeper into radians and complex expressions $\endgroup$
    – Henk Kok
    Commented Oct 2, 2020 at 12:06

You must log in to answer this question.

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