1
$\begingroup$

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.

$\endgroup$

1 Answer 1

1
$\begingroup$

That sounds like a job for a driver. Remove the constraint on Cube.002, right click on it's Y location value and select Add Single Driver. The Y value will then be filled with purple.

You edit the driver value in the graph editor with it's mode set to Drivers. More info on editing drivers is available in the blender wiki.

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.

enter image description here

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .