Rotating the Wheels

 
 
 

In this lesson, you will learn how to rotate the wheels by an amount that corresponds to the distance travelled by the car model.

Let’s start by taking a look at the trigonometry involved in calculating the wheel rotation.

In any circular object, the amount of rotation (a) is defined by the radius of the circle and the arc length encompassed by the a angle. That amount of rotation (a) expressed in radians, is equal to the arc length, divided by the radius of the circle (arc length / R), where:

Therefore, the wheel rotation calculation (arc length / R) becomes distance / 13. Whereas the radius of the wheel is constant and equal to 13, the distance travelled is variable.

Set up the lesson:

Rotate the wheels (in World X coordinates):

  1. In the Perspective viewport, select the Chassis.

    The car is currently oriented on the World X axis: You will begin working in this coordinate system.

  2. Right-click the car body object and from the quad menu, choose Wire Parameters.
  3. From the pop-up menu, choose Transform Position (2nd) Position XYZ X Position.
    NoteIt is important to always leave the first animation controller at the top of the list (in this case, the Position XYZ Controller) untouched, since it serves as a “lock” for the parent/child relationship. When choosing controllers to work on, always work from top of the controller list downward, starting with the second controller.

    A rubber band shows the link you are about to make between your two selected objects.

  4. Click the front left wheel of the car (Wheel-FL).
  5. From the pop-up menu, choose Transform Rotation (2nd) Euler XYZ Z Rotation.

    The Parameter Wiring #1 dialog opens. You use this dialog to set up one-way and two-way control relationships between objects. The position and rotation of the two objects you just selected to affect one another are highlighted.

  6. On the Parameter Wiring dialog, click the right-pointing arrow above “control direction”.

    This ensures that the Chassis X position is controlling the Wheel-FL Z rotation and not the other way around.

    The bottom-right corner of the Parameter Wiring dialog displays the wheel object Expressions panel. It shows the distance travelled as X_Position.

  7. Next to X_Position, type /13.

    The expression should now read X_Position/13, the distance divided by the radius of the wheel.

  8. Click Connect, but do not close the dialog.
  9. Test your work by moving the car body on its X axis.

    Notice how the front-left wheel does not rotate. Even though you added a position list controller to the car and wheel, the first controller in the list (the one that ensures the parent/child “lock”) is still active. You need to make the second position controller (the one used in the wiring process) the active one.

  10. If you moved the car model, press Ctrl+Z to undo the move.
  11. With the car body selected, on the Motion panel PRS Parameters rollout, click the Position button at the bottom of the rollout.
  12. On the Position List rollout, highlight the second Position XYZ controller and click Set Active.
  13. Try moving the car on its X axis again.
    TipTo better see the wheel rotation, use the Front viewport, and change its display mode to Shaded (or Smooth + Highlights. if you are using a legacy viewport driver).

    The wheel now rotates, and at the correct rate, but its motion is backward.

  14. In the Parameter Wiring dialog, on the Expressions panel, add a minus sign (-) in front of the expression, then click Update.
  15. Move the car on its X axis again and notice how the wheel rotates in the proper direction.
  16. Repeat the preceding steps for each of the remaining three car wheels.
    TipTo select the wheels on the right side of the car, you can press H after you choose the car body’s X Position, and then use the Pick Object dialog to pick the wheel.

    Because the wheels were mirrored, the wheels on the right side of the car do not need the minus sign added to their expression, whereas those on the left side do.

  17. Close all the Parameter Wiring dialogs.

Add subcontrollers for Y rotation:

In the previous procedure, you learned how to add controllers that determine car wheel rotation for the length of distance travelled by the model along the World X axis. However, if you tried to rotate the car in any way, wheel rotation would be reduced or stop altogether. You therefore need to add controllers that account for the car’s displacement in a Y direction.

  1. In the Top viewport, select the Chassis object and rotate it –90 degrees (clockwise) so that its front bumper points at 12 o’clock.

    The car is now oriented on the World Y axis, so you will begin working in this coordinate system.

  2. Orbit the Perspective viewport until you can see the front left side of the car.
  3. Move the car forward and backward on the Y axis. Notice that the wheels do not rotate.

    To get the wheels rotating, you will need additional animation controllers, ones that will control the car’s displacement in the Y direction. You will add these as sub-controllers, so you do not overwrite the controllers already in place.

  4. Go to the bottom-left corner of the 3ds Max window, right-click the MAXScript area, and choose Open Listener Window.
  5. On the MacroRecorder panel, highlight the line that reads:

    $.rotation.controller.Available.controller = Euler_XYZ ()

    Be sure not to include the line’s carriage return when you make your selection. Press Ctrl+C to copy this line to memory.

    If you are not continuing from the previous lesson, and line doesn't appear in the Open Listener window, copy the line from the text of this tutorial.

  6. Close the MAXScript Listener window, then select the front left wheel (Wheel-FL).
  7. Click inside the MAXScript entry field (the white box in the bottom-left corner of the 3ds Max window), press Ctrl+V to paste the line of code, then press Enter.
  8. On the Motion panel PRS Parameters rollout, make sure that the Rotation button is active, Then on the Rotation List rollout, verify that a new sub-controller has been added to the rotation list (there should be 3 in all).
  9. Repeat step 7 to add a fourth rotation sub-controller. You will need this later on in the tutorial.

    The front left wheel should now have four Euler XYZ tracks.

  10. Select another wheel and repeat steps 7 to 9 until all four wheels have four Euler XYZ tracks in their respective rotation lists.

Rotate the wheels (in World Y coordinates):

  1. Select the Chassis, then right-click and from the quad menu, choose Wire Parameters.
  2. From the menu, choose Transform Position (2nd) Position XYZ Y Position.
  3. Click the front left wheel (Wheel-FL).
  4. From the menu, choose Transform Rotation (3rd) Euler XYZ Z Rotation.
  5. On the Parameter Wiring dialog, click the right-pointing arrow above Control Direction to ensure that the Chassis Y position is controlling the Wheel-FL Z rotation.
  6. On the right-hand Expressions panel, type /13, then click Connect.

    The expression for the left-hand wheel should be Y_Position/13

  7. Click Connect.
  8. Repeat steps 2 to 7 for each of the other three wheels.
    NoteThe expression for the right-hand wheels should be –Y_Position/13.
  9. Close the Parameter Wiring dialogs.
  10. In the Top viewport, rotate the car so that it is not pointing horizontally or vertically.
  11. On the main toolbar, click (Select And Move), then set the coordinate system to Local.
  12. If you need to, adjust the Perspective viewport so you can see the side of the car.
  13. Move the car on its local X axis. Notice how the wheels are rotating properly.
  14. In the Top viewport, rotate the car until the front bumper is pointing to the left.
  15. Save your file as mycar_rig_03.max.

Rotate the wheels (under a path constraint):

In the previous procedure, you learned how to add controllers that rotate the car wheels for any distance of travel in World X and Y space. The wheels will therefore rotate properly when you manually move the car around the scene in any direction.

However, you would most often animate motion of a car by placing it on a predefined path using the Path constraint. This type of animation requires a different expression.

This new expression uses the same formula (distance divided by radius) as the ones you have been using, but while the radius of the wheel remains constant, the distance travelled is calculated differently.

  1. Continue from the last procedure or open the file car_rig_03.max.
  2. From the main menu Selection Sets list, choose Car Path.

    A warning message displays.

  3. Click Yes to display the path you will use to animate the car motion.
  4. From the main menu, choose Create Helpers Point.
  5. On the Parameters rollout, turn on Box and set Size to 100.0.

    This increases the size of the helper gizmo and makes it easier to select in the scene.

    NoteMany animators use the Dummy helper instead of Point. The advantage of using a Point helper is that you can adjust its size without having to scale it. Scaling a helper in a hierarchy will affect its children objects: This is an effect that usually you want to avoid.
  6. In the Top viewport, click a point near the car to place a Point helper.
  7. With the Point helper still selected, on the main toolbar click (Align), then in any viewport, click the Chassis object.
  8. In the Align Selection dialog Align Position group, make sure X Position and Y Position are on and Z position is off.
  9. In the Current Object and Target Object groups, make sure Pivot Point is chosen, then click OK.
  10. In the Front viewport, move the Point helper on its X axis to the right until it is just to the left of the rear axle of the car.

    Point helper moved to left of rear axle

    The Point helper location you have specified will become the pivot point of the car when the front wheels turn.

  11. On the command panel Name And Color rollout, rename the helper Dummy_CAR.
  12. In any viewport, select the Chassis.
  13. On the main toolbar, click (Select And Link), then in the Front viewport, click the Chassis and drag to the Point helper. This makes the car body the child of the Point helper.
  14. On the main toolbar, click (Select Object) to exit link mode.
  15. From the main toolbar Selection Sets list, choose Garage_All. Click Yes to dismiss the warning and unhide the rest of the scene geometry.
  16. In the Top viewport, use (Zoom Extents) to view the entire parking lot.
  17. In the Perspective viewport, click the Perspective label and from the menu, choose Cameras Camera_Wall-E.

Animate the dummy by constraining it to a path:

  1. In any viewport, select the Dummy_CAR helper.
  2. From the main menu, choose Animation Constraints Path Constraint.
  3. In the Top viewport, click the green path (CarPath).

    The helper and the linked car are repositioned at the start of the path.

    NoteYou could, as an alternative, constrain the car directly to the path. In this case, however, it is preferable to constrain the helper parented to the car so you can retain extra control over the car’s behavior (such as defining skids around tight corners).

    The path is a NURBS curve.

    TipNURBS curves, when used as animation paths, provide a smoother “ride” than ordinary splines.
  4. Scrub the animation.

    The car’s orientation remains constant throughout the animation.

  5. In the Motion panel Path Parameter rollout Path Options group, turn on Follow.
  6. Scroll down to display the Axis group, and turn on Flip.

    The Flip option prevents the car from driving in reverse.

  7. Scrub the animation again.

    The car is properly oriented on the path, but the wheels no longer rotate. This is because the expression that defined the wheel rotation you formulated earlier no longer applies. The distance travelled by the car was dependent on the X and Y displacement in the World coordinate system. Displacement is now tied to the length of the path and the percentage of the path that the car has travelled. You must add wiring that reflects this change.

Wire wheel rotation to a path:

  1. In any viewport, select the animation path (CarPath) then go to the Utilities panel.
  2. Click Measure and in the Shapes group, take note of the path length.
  3. Select and right-click the Point helper, then from the menu choose Wire Parameters.
  4. From the menu, choose Transform Position Path Constraint Percent.
  5. Click one of the car wheels and choose Transform Rotation (4th) Euler Rotation Z Rotation.
  6. On the Parameter Wiring dialog, set the control direction to the right, which places the Percent parameter in control of the wheel rotation.
  7. On the right-hand Expressions panel, type (2365*Percent)/13.
    NoteThe value 2365 is the length of the animation path you measured earlier. When multiplied by the percent variable, it calculates the distance the car has travelled at any given moment in time along the path. When divided by the radius of the wheel (13), it provides the amount of rotation needed for the wheel to turn.
  8. Click Connect.
  9. Scrub the animation to see the wheel rotation.
  10. To better see the animation, click (Time Configuration) and in the Time Configuration dialog Time Display group, choose FRAME:TICKS.
  11. Repeat steps 3 to 8 to link the Point helper to each of the remaining three car wheels.

    Remember to add a minus sign (-) operator to the expression of the wheels on the right side of the model so they don’t rotate in the opposite direction.

  12. Save your file as mycar_rig_04.max.

Next

Pivoting the Wheels

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License