2
$\begingroup$

Im trying to solve a certain problem. i've tried several different approaches, but since i have not found any solution yet, i'm asking you guys.

I have a rotating object(1). Now i want an other object(2) to change the value of it's shape-keys, for only the duration of one quarter of object 1's full 360° turn. (=90°)

enter image description here

I don't want to keyframe the whole process because i have several rotating object, but they all rotate in different speeds and offsets. I want to be able to change the speed in which object 1 is turning without having to manually adjust object 2. So i would like to use drivers for this task. But i have no idea of scripted expressions being any more complicated than e.g. var*.5 etc. Can somebody show me a way (scripted expression) which delivers an output of 1 for the duration of a 90° rotation and 0 for the remaining 270°? Or even an other approach.

$\endgroup$
2
$\begingroup$

Angles 0-90° has positive cos and sin so we use this logic statements
cos(rot)>0 and sin(rot) >0 which evaluate to 1 when the angle is 0-90° and 0 otherwise :

enter image description here

Note: the angle is in radian

$\endgroup$
  • $\begingroup$ Thank you very much for the quick answer! Works perfectly fine! $\endgroup$ – Järv Mar 31 '15 at 8:29
  • $\begingroup$ @Järv you're welcome , drivers can handle much complex functions if you need so just ask $\endgroup$ – Chebhou Mar 31 '15 at 8:32
  • $\begingroup$ I've started to try around with some functions. But still I lack of the knowledge which terms are accepted. $\endgroup$ – Järv Mar 31 '15 at 12:57
  • $\begingroup$ E.g. I tried to offset the function above by 180°. Now the expression should evaluate to 1 when sin(rot) and cos(rot) both equal 0. ( means Object is rotating from 270° to 360°) I hoped for a lucky shot by adding following expression: sin(rot) is 0 and cos(rot) is 0 but of course it didn't work. Any tips? $\endgroup$ – Järv Mar 31 '15 at 13:05
  • $\begingroup$ it will be cos(rot) >0 and sin(rot)<0 in that quarter the cos is positive but the sin is negative $\endgroup$ – Chebhou Mar 31 '15 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.