Animating the Spacefighter with Constraints and Controllers
 
 
 

In this lesson, you'll use an assortment of constraints and controllers with a flight of spacefighter on a mission.

Set up the lesson:

Using a Dummy Object to Control the Flight

Dummy objects are helper objects. You can create them from the Helpers button on the Create panel. They can be useful when setting up an animation. By animating a dummy, you can focus on getting your motion set up using a very simple object that doesn't slow down your system. Once the dummy animation is complete you link objects to the dummy. Now wherever the dummy moves, the object goes with it.

Link the spacefighters to the dummy:

  1. Activate the Top viewport, if it's not already active, and click the Select And Link button from the Main toolbar.
  2. Select FlightLeader and drag the cursor over the dummy, SpaceshipControl. Release the mouse button.

    FlightLeader is now linked to the SpaceshipControl. Wherever you move SpaceshipControl, FlightLeader will follow.

  3. Link both Wingman01 and Wingman02 to SpaceshipControl.

Add a path constraint to the dummy:

  1. In the Top viewport, use Zoom Extents to view the scene.
  2. Click Select Object to turn it on and turn off Select And Link.
  3. Select SpaceshipControl.
  4. From the Animation menu, choose Constraints > Path Constraint. Drag the cursor and click the flightpath.

    SpaceshipControl jumps to the beginning of the path. The spacefighters follow along since they're linked to the dummy.

  5. In the Path Parameters rollout, make the following settings.
    • Turn on Follow, Bank, and Constant Velocity.
    • In the Axis group, turn on Y and Flip.
    • Set the Bank Amount to 7.0 and the Smoothness to 1.0.
  6. Activate the SpaceCam viewport and play the animation.

    All three spacefighters move along the flightpath.

  7. Save the scene as MyFlight01.max.

Making the Camera Follow the Action

In this exercise, you'll use the Link Constraint to make the camera follow the flight as it passes by. Continue from the last lesson or load flyingspacefighter04.max

Add link constraint to the camera:

  1. Open the Display panel and turn off Cameras in the Hide By Category rollout.

    The camera, SpaceCam, will appear.

  2. In the Top viewport, use Zoom Extents to view the scene. Select the camera target.

    Also make sure the time slider is set to frame 0 (zero).

  3. From the Main menu, choose Animation > Constraints > Link Constraint. Click the flightpath to set the first Link Parameter at frame 0 (zero).
    NoteFor this step and the one that follows, Auto Key doesn’t need to be turned on, because the Link constraint is active.

  4. Move the time slider to frame 80 and click the Add Link button in the Link Params rollout. Click SpaceshipControl.

  5. Click Add Link to turn it off.
  6. Activate the SpaceCam viewport and play the animation.

    The camera target is linked to the flightpath from frames 0 to 79. At frame 80, the camera target begins to specifically track the SpaceshipControl object.

  7. Save the scene as MyFlight02.max.

Your Flight Leader Gets Cocky

Your flight leader has a pretty bold character. He or she feels a victory roll is in order as the flight passes by your vantage point from SpaceCam. In this exercise, you'll use the Orientation Constraint to control the rotation of the flight leader's spacefighter as it performs a barrel roll. Continue from the last lesson or load flyingspacefighter05.max.

  1. In the Top viewport, use Region Zoom to view the three spacefighters.

  2. On the Create panel, click Helpers, then Dummy. Create a new dummy object near the FlightLeader and name it barrelroll.

  3. Click Select And Link and link barrelroll to SpaceshipControl.
  4. From the Tools menu, choose Align, and click SpaceshipControl.

    The Align Selection (SpaceshipControl) dialog appears.

  5. In the Align Position (Screen) group, turn off the X, Y, and Z Positions.
  6. In the Align Orientation (Local) group, turn on the X, Y, and Z Axis controls and click OK.

    The barrelroll dummy now has the same orientation as the SpaceshipControl.

  7. On the Motion panel, open the Assign Controller rollout, if it's not open, and select the Rotation: Euler XYZ controller.
  8. Click the Assign Controller button and choose TCB Rotation from the Assign Rotation Controller dialog.
    NoteDon't miss this step. It allows you to rotate the barrelroll dummy about its local Y axis.

Animate the victory roll:

  1. Select the FlightLeader in the Top viewport.
  2. Open the Animation menu and choose Constraints > Orientation Constraint. Move the cursor over the barrelroll dummy and select it.

    You'll see barrelroll added to the Orientation Constraint Target list on the Motion panel.

  3. Select barrelroll and make sure the time slider is at frame 0 (zero).
  4. Turn on the Set Key toggle and click the Set Key button.
  5. Move the time slider to frame 110 and click Set Key again.

    You've added two keys that will keep the FlightLeader flying normally from frames 0 to 110.

  6. Activate the SpaceCam viewport and move the time slider to frame 130.
  7. Click Select And Rotate and change the Reference Coordinate System to Local.

  8. Click the barrelroll dummy and rotate it around the Y-axis to about 180 degrees and click the Set Key button.
    NoteIf you'd like to be precise, you can enter the rotation in the Y-axis type-in field on the status bar.

  9. Move the time slider to frame 150 and rotate the barrelroll dummy around the Y-axis another 180 degrees and click the Set Key button. Turn off the Set Key Toggle when you've finished.
  10. Save the scene as MyFlight03.max and play the animation.

A Wingman in Trouble

While the FlightLeader is performing stunts, Wingman01 seems to be having some trouble. He doesn't seem to be flying as smoothly as the others. In this exercise, you'll use the Noise Controller to add some turbulence to Wingman01 flight dynamics. Continue from the last lesson or load flyingspacefighter06.max.

NoteIf you continue from the last lesson, make sure the time slider is back on frame 0 (zero).

Add turbulence:

  1. In the Top viewport, use Region Zoom to view the three spacefighters, if you haven't done so already.

    You might have to do a Zoom Extents first, then a Region Zoom to see the three fighters.

  2. Select Wingman01.
  3. On the Animation menu, choose Position Controllers > Noise.

    Doing this automatically adds a List Controller to the Wingman01. The Position List contains the original Linear Position and the new Noise Position controller with default Weight settings of 100.0 percent.

  4. Play the animation and note the erratic flying of Wingman01.
  5. Stop the playback and change the Weight of the Noise Position controller to 25.0 percent.

    Now the flight path of the Wingman01 spacefighter is affected by slight battle damage.

  6. Save the scene as MyFlight04.max.

A Wingman Is Called Away

Now it looks like Wingman02 has received a transmission and is being ordered to peel off and fly somewhere else. You'll revisit the Link Constraint to make Wingman02 follow the FlightLeader for a little while then take off on another path. Continue from the last lesson, or load flyingspacefighter07.max.

Alter course for Wingman02:

  1. Reset your time slider to frame 0 (zero) and zoom to the trio of spacefighters in the Top viewport.
  2. Create a new dummy near Wingman02 and call it WingmanControl.

  3. Right-click any viewport and choose Unhide By Name from the quad menu. Select wingmanpath and click Unhide.

    A yellow path appears in front of Wingman02.

  4. Make sure the new dummy, WingmanControl, is still selected and choose Animation > Constraints > Path Constraint. Drag the cursor over and pick wingmanpath.

    The WingmanControl jumps to the beginning of wingmanpath.

  5. In the Path Parameters rollout duplicate the previous settings.
    • Turn on Follow, Bank, and Constant Velocity.
    • In the Axis group, turn on Y and Flip.
    • Set the Bank Amount to 7.0 and the Smoothness to 1.0.

      If you play the animation, you'll see WingmanControl on its own path.

      Tip To better see Wingman02 fly away, before you play the animation go to frame 0, activate the SpaceCam viewport, turn on the Field-of-View navigation button, and drag downward in the SpaceCam viewport until in frame 0 you can see the entire loop of wingmanpath, and a bit of FlightLeader, at the right-hand side of the viewport.

    SpaceCam viewport with a larger Field-of-View

Make Wingman02 change paths:

  1. In the Top viewport, select Wingman02 and click the Select And Unlink button.

    Wingman02 is no longer linked to the SpaceshipControl dummy object.

  2. From the Animation menu, choose Constraint > Link Constraint and select SpaceshipControl.

    Wingman02 will work as it did before, but the link constraint will give you the flexibility to have it follow a different path.

  3. Move the time slider to frame 45 and click the Add Link button in the Link Params rollout on the Motion panel.
  4. Click the WingmanControl dummy.

    You will see WingmanControl is added to the Target list, and when Wingman02 gets to frame 45, the spacefighter begins to follow the WingmanControl dummy on the other path.

  5. Save the scene as MyFlight05.max and play the animation.

Make Wingman02 roll out of formation:

To make Wingman02 roll out of formation, you'll use the Orientation Constraint again.

  1. Move the time slider back to frame 0 (zero), if it's not there already.
  2. Create another dummy object in the Top viewport near Wingman02 and name it wingmanroll.

  3. Use Select And Move to position wingmanroll next to Wingman02.

    Watch the Front and Right viewports to help you position it. This will help you keep the objects in your scene organized.

  4. Click Select And Link and link wingmanroll to WingmanControl.
  5. From the Tools menu, choose Align, and click WingmanControl.

    The Align Selection (WingmanControl) dialog appears.

  6. In the Align Position (Screen) group, make sure the X, Y, and Z Position controls are turned off.
  7. In the Align Orientation (Local) group, turn on the X, Y, and Z axis controls and click OK.

    The wingmanroll dummy aligns to WingmanControl.

    NoteThis is important because you want to make sure that rotation values you give wingmanroll , later on, will be based on the initial orientation of WingmanControl . Otherwise, any rotation you give wingmanroll will result in the spaceship tumbling out of control.

  8. On the Motion panel, open the Assign Controller rollout, and select the Rotation: Euler XYZ controller.
  9. Click the Assign Controller button and choose TCB Rotation from the Assign Rotation Controller dialog.
    NoteIf you don't assign the TCB Rotation controller, you will not be able to rotate wingmanroll about a local axis.
  10. Select Wingman02 in the Top viewport.
  11. Open the Animation menu and choose Constraints > Orientation Constraint. Move the cursor over wingmanroll and select it.

    You'll see wingmanroll added to the Orientation Constraint target list in the Orientation Constraint rollout on the Motion panel.

  12. Select wingmanroll in the Top viewport.
  13. Turn on the Set Key toggle and click the Set Key button.
  14. Move the time slider to frame 60 and click Set Key again.

    You've added two keys that will keep Wingman02 flying normally from frames 0 to 60.

  15. Activate the SpaceCam viewport and move the time slider to frame 85.
  16. Click Select And Rotate and change the Reference Coordinate System to Local.
  17. You'll make two rotations during this step:
    • Enter –15 in the X-axis Coordinate Display Type-in field and click the Set Key button.

    • Enter 90 in the Y-axis Coordinate Display Type-in field and click the Set Key button.

  18. Move the time slider to frame 100 to make the next two rotations:
    • Rotate 5 degrees around the Z-axis and click the Set Key button.
    • Rotate 90 degrees around the Y-axis and click the Set Key button again.
  19. Move the time slider to frame 115 to make the next two rotations:
    • Rotate 10 degrees around the Z-axis and click the Set Key button.
    • Rotate 90 degrees around the Y-axis and click the Set Key button again.
  20. Turn off the Set Key toggle when you've finished. Save the scene as MyFlight06.max and play the animation.

Next

Taking Control of Mars, Its Moons, and the Space Station