# Transform Constraint

I have 3 animated cubes, two of which, Cube 1 and Cube 2, start stacked on top of each other and off to the negative X of the other one, Cube 3. Cube 1 moves forward along the X axis. Cube 2 moves along the X axis under Cube 1 (transform constraint) while rotating around its Z axis. Cube 3 moves from Y=0 to Y=2 for every full (360°) rotation of Cube 2, then it jumps back to Y=0 as Cube 2 begins another rotation.

I would like to change this behavior so that, within one 360° rotation of Cube 2, Cube 3 would move from Y=0 to Y=2 and then smoothly back to Y=0, behaving like a pendulum.

See the animation in my .blend file; I hope that helps you understand me.

You want to use the Z rotation of Cube.001, displaying the debug value shows that it varies from -180 to 180. You want to ignore the negative part of the value so abs(var) will remove that, then divide that by 180 and multiply it to get a larger range of movement. That leaves you with a calculation of (abs(var)/180)*100. Changing the 100 used will change the distance Cube.002 moves. You can add a value at the end to move the range of movement away from 0.0.