This tutorial will show you how to set up advanced physics constraints to synchronize the rotation of gear-like mechanisms.
First you'll need to know the basics; how to add gears and how to set up a master and slave gear. You should already be familiar with physics Point Constraints, Meshes, and Rigidbody components.
In the Properties, click +Add Component and add a Physics →Point Constraint component to your gear. To allow full free rotation around one axis and eliminate any wobble on other axes, set the Minimum X Angle to -360 and the Maximum X Angle to 360. Set the desired axis (perpendicular to the diameter of the gear, like the axle of a wheel) to 1. (You'll see the "axle" represented by a yellow line as long as your helpers are enabled):
Axle line
Via the Create Object tool, add an Empty Entity that will be used to link the movement between the gears. Technically, while this entity has no constraints attached to it, it is the "owner" of the constraint. In this example, we'll name it "gear_linker."
For clarity, we recommend renaming the entity link between the gear and the linking entity to something that clarifies its role, such as "gear_linker":
Rename entity link
In order to create the illusion that one gear is making the other(s) move, position the two gears at any angle you like, but such that the teeth or surfaces of the gears appear to engage or touch. Depending on your gear design, you may need to rotate one of the gears around its axle so its teeth appear to engage:
Gears engaging
Go to Properties → +Add Component and add a Physics →Plane Constraint component to the master gear.
Set the Plane Constraint component's Axis so the plane's normal (the yellow line that emerges perpendicular from the plane) is parallel to the common movement axis (rotation). For simple, synchronous rotation, position the Plane Constraint as close as possible to where the two gears contact each other, or halfway between each other if they are separated. With two gears standing up and facing the camera, the Plane Constraint's normal (not the plane itself) should be vertical (facing up or down makes no difference), like this:
Plane Constraint normal and position
Set the Plane Constraint component's Twist rotation min angle to -360, its Twist rotation max angle to 360, and its Bend max angle to 180.
Of course this gear functionality is not limited to one master gear and one slave gear, or making the gears turn in opposite directions. You can have many "slave" gears driven by a "master," but you must use a separate Plane Constraint component for each slave gear, using a unique link name for each Plane Constraint's Target Link Name (the link to the corresponding slave gear) and the same name of the link to the linker entity for each Plane Constraint's Helper Link Name.
You can also use slave gears as masters to drive additional gears linked directly to them. The Point Constraint on this master/slave gear will serve both its slave and master functions, but you will need to add a Plane Constraint component to the master/slave gear for each of its slave gears, along with the appropriate link names as described above.
Setting up multiple slave gears is fairly straightforward.
It may be beneficial to rename the links to describe which gears they link to, rather than just an arbitrary "slave-1", "slave-2" etc, which may become confusing when adding more and more slave gears.
Of course, gears aren't always positioned neatly in a straight line; sometimes a slave gear is off to the top left or right of the master gear. All you really need to do is move the gear and rotate the Plane Constraint. Rotating the Plane Constraint is not done with Transform → Rotation, however. The property you'll need for this is Axis:
Change Axis for rotation Plane Constraint
Be sure to first carefully at the entity links on your master gear and be sure that you're moving the correct plane constraint!
Together with changing the Translation, you can position the Plane Constraint perpendicular to the contact point between the master and slave gears, like this:
Plane Constraint rotated
Now they will rotate like this, in opposite directions, as if intermeshed:
Offset slave gear rotating
If you want your gears to rotate in the same direction, like for example wheels in tank treads do, this is how you need to set it up:
To make the gears rotate in the same direction, the Plane Constraints generally need to be quite far away:
Same Direction Plane Constraints
In this example, with the gears 1m in diameter and fairly close together, the Plane Constraints for the three slave gears are 80m, 120m and 160m away from the master gear, respectively.
Finally, any slave gear can also be used as a master gear to drive its own set of slave gears if necessary; you simply need to set up the same links and plane constraints between the secondary master and its slaves (in addition to that secondary master being a slave to a primary master).
For more detailed information and to watch a video tutorial about these setups, see below.