This tutorial will show you how to animate gear motion relative to motion of the other.
I am going to show you two ways to do it.
First of all lets make a model of two gears.
Create a polygon cylinder with cap segments to 0 and Height = 0.3
Then select every second face.
And then extrude those faces; and then under Inputs > polyExtrudeFace1, change these values Local translate Z = 0.5 and Local scale Y = 0.5
So one gear is done.
Create another cylinder with 40 segments.
Then select every second faces and extrude those faces; and then under Inputs > polyExtrudeFace1, change these values Local translate Z = 0.5 and Local scale Y = 0.5
Under inputs > polyCylinder2 change radius = 2 and Height = 0.3
Select the second cylinder and then change these attributes values:
Translate Z = -3.6
Rotate Y = -0.5
ANIMATING THE GEARS
First method using Set Driven Key
Then go to animation menu set, and then animate/set driven key/set and open its Option Box.
Select the 2nd gear you will be rotating, when animating, and click load driver, choose rotateY on the right side.
Then select other gear and click load driven, choose rotateY on the right side.
Press Key button. Don’t close this window.
Notice how driven objects rotateY got orange in the Channel attribute Editor Window, this means that it has curve as input which can be seen in the Graph Editor Window.
Now select the gear in the Driver window and then in channel attribute editor window change the Rotate Y value to 17.
Then select the gear in the Driven window and then change its Rotate Y value in channel editor window to -35
And then click on the KEY button.
If you rotate driver object, driven will rotate also, but only one step.
Select driven object and go to Graph Editor.
Notice one green curve. This curve defines relation between driver object rotationY and driven object rotationY.
Go to view/infinity
Now you can see how curve looks before and after keys. So in our case this means that gear will rotate only between those two keys, and before and after it will be constant, that’s why the second gear rotates only one step.
In the Graph Editor window, select the curve using LMB and Drag then go to curves->pre infinity->linear and curves->post infinity->linear.
Now when you rotate first gear second rotates well.
Second method using Expressions
Select driven object ( in our case it is the 1st cylinder ) on RotateY, and right click on the Word RotateY then choose Break Connections.
Then in the same menu choose expressions and the type
pCylinder1.rotateY=pCylinder2.rotateY*(-2)-0.5;
So Cylinders rotate same as in first example.