0
$\begingroup$

What I want to achieve starts pretty standard: the rotation of object A rotates object B. I use a driver. No prob.

Where I’m stuck is that I want certain portions of A’s rotation to rotate B faster and certain potions of A’s rotation to rotate B slower.

For instance:

  • Rotate A 0-90deg = rotate B 2xA rotation speed
  • Rotate A 91-180 deg = rotate B 1/2A rotation speed
  • Rotate A 181 - 270 deg = rotate B 3/4A rotation speed
  • Rotate A 271-360 deg = rotate B = A rotation speed

This has to be possible, right?

$\endgroup$

1 Answer 1

2
$\begingroup$

Use a scripted expression. For what you have, given input rotation "var", you might use something like,

(2 * min(max(var, 0),pi/2)) + (0.5 * min(max(var-(pi/2), 0),pi)) + (0.75 * min(max(var-pi, 0),0.75*pi)) + max(var - (0.75 * pi), 0)

Rotations in drivers are in radians, not degrees, hence all the "pi"s. Be aware that if you're going to read rotations of >180 degrees, you're only ever going to get them from "single property" type variables, never from "transform channel" type variables. max() is a python function that returns the greatest of its parameters; min() returns the least of its parameters.

An alternative is to edit the driver curve in a driver editor viewport. You can add new points to the curve and adjust the controls and handles just as you would any other f-curve in Blender. Adjusting the driver curve would be preferable if you wanted smooth transitions (but you can use vector handles there to make sharp transitions if you want.)

$\endgroup$
4
  • $\begingroup$ Works well after adding another parenthesis before pi in the first section. My problem is that as object A continues to rotate 360+ degrees, the last term in the equation controls it. I need the whole thing to reset when object A gets to 360 degrees. What i want is that object A continually rotates and every time it gets to the 0-90degree portion of its reset rotation, object B always does the 0-90 degree rotation. Is this possible? $\endgroup$
    – NicoPico
    Commented Sep 25, 2023 at 14:16
  • $\begingroup$ Then replace "var" with "var%(2*pi)" to get rotation, modulo 360 degrees. Fixed parentheses, thanks. $\endgroup$
    – Nathan
    Commented Sep 25, 2023 at 14:25
  • $\begingroup$ Replace all the vars in your statement with var%(2*pi)? $\endgroup$
    – NicoPico
    Commented Sep 27, 2023 at 15:01
  • $\begingroup$ Yes, that's correct. Probably best to enclose it in parentheses, (var%(2 * pi)), for order of operations. $\endgroup$
    – Nathan
    Commented Sep 27, 2023 at 15:31

You must log in to answer this question.

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