# Use driver to deliver output depending on the state of an objects rotation

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°)

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.

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 :

Note: the angle is in radian

• Thank you very much for the quick answer! Works perfectly fine!
– Järv
Commented Mar 31, 2015 at 8:29
• @Järv you're welcome , drivers can handle much complex functions if you need so just ask Commented Mar 31, 2015 at 8:32
• I've started to try around with some functions. But still I lack of the knowledge which terms are accepted.
– Järv
Commented Mar 31, 2015 at 12:57
• 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?
– Järv
Commented Mar 31, 2015 at 13:05
• it will be cos(rot) >0 and sin(rot)<0 in that quarter the cos is positive but the sin is negative Commented Mar 31, 2015 at 15:38