There are no shortage of tutorials that will show you how to create a wheel rig in Maya, so that the wheel can automatically rotate based on the distance an object is moved. Most of these tutorials however, will use simple circumference maths that gets plugged into a single axis channel. This means that if you are moving your car, or object in one direction, it works great. If the car needs to turn however, things break down.

This is why Andrew Christophersen suggests that you use world vectors instead. Sampling world vectors at runtime will allow you to update your rotations, knowing exactly where the wheel is, and the distance it has traveled through 3D space.

If you watch the video, Andrew shows how you can build a wheel rig using the world vector technique, walking through all the steps, with an example of the expressions that were used.

Maya Expression for Using World Vectors for Wheel Rig Rotations:

float $radius = 25;
vector $moveVectorOld = `xform -q -ws -t “rightWheelOld”`;
vector $moveVector = `xform -q -ws -t “R_Wheel”`;
vector $dirVector = `xform -q -ws -t “rightWheelDir”`;
vector $wheelVector = ($dirVector – $moveVector);
vector $motionVector = ($moveVector – $moveVectorOld);
float $distance = mag($motionVector);
$dot = dotProduct($motionVector, $wheelVector, 1);
R_Wheel.rotateZ = R_Wheel.rotateZ + 360 / (6.283*$radius) * ($dot*$distance) * (Root_CTRL.rightWheelAuto);
xform -t ($moveVector.x) ($moveVector.y) ($moveVector.z) rightWheelOld;
if (frame==0) { R_Wheel.rotateZ = 0;