You can visit the page http://en.wikipedia.org/wiki/Rack_and_pinion for the definition. I tried to do it without any help, i was about hopeless but at the end i did the same animation inside the blender.

Let’s do it step by step:

1. You can use an “add-on” named “Add Mesh: Extra Objects” to add a gear

ScreenShot002

2. Change the radius a little (because it has a weird face deformation in my blender)

ScreenShot003

3. Add a plane (and add a blue material) and place the camera on top of them:

ScreenShot004

4. I put another gear but i deleted most vertices to make it flat (linear position) then used “Array” modifier for longer rack (like railways):

ScreenShot001

5. Might need some modeling exercise for you to make the upper movable part🙂

ScreenShot005

ScreenShot006
Don’t forget to “Apply” the array and recenter its origin.

6. Now we can add “Add Passive” to the ground plane and “Add Active” to the 2 metallic parts:

ScreenShot007

7. Press “Alt+A” to see the animation. If you get some foolish bounces, you can fix them caring the moving parts not to touch too much close and placing inside the ground plane.

8. We need a continuous rotation animation for the first gear. This will be the engine of the simulation.

In short, i added keyframes to the 1st and 75th frames for “Rotation Z axis” from 359 degrees to 0 degree (for turning clockwise).

ScreenShot008

9. It will not turn until you check “Animated” in the Physics properties panel. Let’s make it rotate continuously by using “Animation” screen layout.

ScreenShot009

Select with “A” and press “V” to make the animation “Vector” and put a modifier “Cycles” to the last dot.

ScreenShot010

10. The engine (pinion) gear pushes the linear (rack) gear to the side. Now for the last steps, we need to stabilize the 2nd gear to move properly.
Change shape to “Mesh” and “Sensitivity: Margin: 0.0020” for the both objects.

ScreenShot011

Add “Rigid Body Constraint” to the 2nd gear, change the values like this:

ScreenShot012

Now it looks better but it stops some time later, you can fix it changing “Solver Iterations: 1” in the Scene panel.

ScreenShot013

There we go! I hope this text tutorial didn’t hurt your eyes so much, feeling sorry for beginners.

Here is my animation: http://www.youtube.com/watch?v=521ubUVy63E

Full document: http://tr.scribd.com/doc/130743686/Rack-and-Pinion