My question is pretty simple.
How to make an object copy rotation of another object with same speed but only every second circle. I know I can animate that using keyframes, but I need to have in constraint.
My question is pretty simple.
How to make an object copy rotation of another object with same speed but only every second circle. I know I can animate that using keyframes, but I need to have in constraint.
You could add a scripted driver to the desired rotation axis of the object with the intermittent rotation, using the following expresion:
var*(int((var/(2.0*pi))%2))
where the variable var, (or whatever you want to call it) refers to the relevant rotation (X,Y,or Z) of the driving object.
Here, the Z rotation of the triangle is being driven by the expression, in which var refers to the the Z rotation of the square.
EDIT in response to your comment:
We can make the expression a little more general by implicitly casting True and False to 1 and 0:
var*(int((var/(2.0*pi))%3)==1)
In this version, the number where the 3 is determines the number of turns in the cycle, and the number where the 1 is says which of the turns to follow, with 0 as the last, counting back. So this example would make the driven object follow the driver on the second of every three turns.
So, in order to have alternating rotations, in the example below, the green triangle uses:
var*(int((var/(2.0*pi))%2)==1)
..and the yellow triangle uses:
var*(int((var/(2.0*pi))%2)==0)
Any more than this - say, "the second and fifth out of every seven".. and it would probably be tidier to write a little function, and add it to the driver_namespace.
var * (var // twopi)Mod is handy for mapping [eg mapping on 0, 1 for offset on an orbit](https://blender.stackexchange.com/a/118300/15543) div//` wil give you the whole number that you are calculating with int-divide-modulus combo
– batFINGER
Sep 29 '18 at 20:13
int, (e.g. var* (((var//(2.0*pi)%5))in[1,2])) but I can't figure out how to have an infinite cyclic function without a % somewhere. Please go ahead and fix the answer, if you like.
– Robin Betts
Sep 30 '18 at 00:53
var if 1.0 <= (var // twopi) % 5 <= 2.0 else 0 Ternary op can be nested.
– batFINGER
Sep 30 '18 at 03:06