Hello.
I have a wheel, when it rotates the lights should flash.
when the wheel makes a turn of 30 degrees, the light (A) lights up ; 120 degrees , the light (B) light up...
but after 360 degrees my wheel keeps increasing degrees 361 , 362++
how to make a loop (in expression)so that after 360 the wheel starts from 0 ?
Hi!
Writing an expression like this would be easy, I would advice against this solution. Eventhough it will look correct in the viewport, if you render with motion blur, the motionblur on the wheels will be very inconsistent. Since the wheels will turn 359 degrees backwards on a single frame
I would rather look, that you lights just react to all the correct values. For example, your light A lights up at 120 but also at 480, 740 and so on.
The easiest way to achieve this, is to use a cycled set driven key. You use your wheels rotation value as the driver, then you animate the range of 0 to 360 degrees with the light turning on and off at the correct points. After that you just need to set the pre and post infinity curves to cycle and your lights should work correctly at every rotation of the wheel.
I made a short video to show how this is done, because I find that set Driven Key setups are always a bit confusing when the are just described in text:
I hope it helps!
Can't find what you're looking for? Ask the community or share your knowledge.