BONUS CHAPTER 8

Creating Character Crowds

IN THIS CHAPTER

Using Crowd and Delegates

Nobody likes crowds (except for certain types of bugs), but with the Character Studio's Crowd Animation tools, controlling crowds can be lots of fun. The fun comes when you realize that you would spend weeks animating by hand all the actions that are possible with the Crowd animation tools.

Characters included in a crowd simulation are called delegates, and these delegates can have assigned behaviors that tell them to follow a certain object or a certain path and to avoid designated objects. As you begin to simulate crowds, you'll delight in how much it is like taking the whole family shopping together, except the delegates actually do what you say.

Creating Crowds

Crowd systems are composed of two helper objects called Crowd and Delegate, but the system also can use other scene objects that can be avoided or followed.

Using Crowd and Delegate helpers

Crowd and Delegate helper objects are created using the Create image Helper image Crowd or Delegate menu commands. The Crowd object looks like a simple dummy object, and the Delegates are simple pyramids. Objects can be linked to a behavior object that travels along with it.

Several of the tools you need to define the crowd system are accessed from the Setup rollout, shown in Figure 1.

FIGURE 1 Use the Setup rollout to define the crowd system.

image

Scattering delegates

imageIf only a single delegate is created, it is not much of a crowd. Multiple delegates can be created using the various cloning methods or using the Scatter button located in the Setup rollout in the Modify panel when the Crowd object is selected.

Cross-Reference

The various cloning methods are covered in Chapter 8, “Cloning Objects and Creating Object Arrays.”

Clicking the Scatter button causes the Scatter Objects dialog box, shown in Figure 2, to open. This dialog box includes several panels used to randomize the Position, Rotation, and Scale of the cloned delegates. In the Clone panel, you can select the Object to Clone and How Many clones to create. After the settings are correct, click the Generate Clones button to create the duplicates.

FIGURE 2 The Scatter Objects dialog box lets you quickly create crowds of objects.

image

Setting delegate parameters

imageEach selected delegate has parameters that can be set in the Modify panel, including its dimensions, Speed, Acceleration, and Turning values. With the Crowd object selected, you can click the Multiple Delegate Editing button to open a dialog box, shown in Figure 3, that lets you change the parameters of multiple delegates simultaneously.

In the upper-left corner, you can select the delegate objects to change using the Add button. You can then specify two values for the parameters. If the Random option is specified, the parameter falls somewhere between the two values. You also can save groups of settings using the drop-down list in the lower-left corner of the interface.

FIGURE 3 The Edit Multiple Delegates dialog box lets you quickly set the parameters of multiple delegates.

image

Assigning behaviors

Within the Setup rollout of the Crowd object is a New button that lets you add new behaviors that can be used with the crowd system. All behaviors that are added to the crowd system appear in a drop-down list. By typing a new name in the list, you can name each behavior. The available behaviors include the following:

  • Avoid: Prevents collisions between scene objects and other delegates
  • Orientation: Controls the direction the delegates face
  • Path Follow: Forces delegates to move only along a designated path
  • Repel: Forces delegates to move away from a target object
  • Scripted: Makes a delegate behave using a MAXScript
  • Seek: Moves delegates toward a target object
  • Space Warp: Uses a Space Warp object to control behavior
  • Speed Vary: Changes the speed of delegates as they move about the scene
  • Surface Arrive: Moves delegates toward a surface
  • Surface Follow: Moves delegates across a surface
  • Wall Repel: Uses a grid object to repel delegates
  • Wall Seek: Uses a grid object to attract delegates
  • Wander: Makes delegates move randomly

When a behavior is selected from the Setup rollout, a custom rollout of parameters for the selected behavior appears. Using these parameters, you can govern how the behavior acts and select which objects are targets.

imageAfter the behavior's parameters are set, you can assign specific delegates or teams of delegates to use certain behaviors in the Behavior Assignments and Teams dialog box, shown in Figure 4. This dialog box is opened using the Behavior Assignment button found in the Setup rollout.

FIGURE 4 The Behavior Assignments and Teams dialog box lets you organize teams of delegates and assign them to behaviors.

image

All behavior assignments are listed in the center pane, and each assignment can be given a weight. If the delegate has two conflicting behaviors to follow, then it follows the one with the greatest weight value.

Solving the simulation

The final step in the process is to solve the simulation. This step creates keyframes for all the motion in the scene. To solve the simulation, click the Solve button in the Solve rollout, or click the Step Solve button to solve for a single frame at a time. By default, the solution saves keyframes for every frame, but you can increase the Positions and Rotations values to compute the simulation faster.

Tutorial: Rabbits in the forest

This example uses the delegate primitives linked to rabbit meshes to navigate through a forest. Moving several objects through an array of objects can be time-consuming when done by hand, but the Crowd system makes it easy.

To move a group of rabbit delegates through an array of trees, follow these steps:

  1. Open the Bunny in the forest.max file from the Bonus Chapter 8 directory on the CD. This file includes several pine trees and a bunch of bunnies.
  2. Select the Create image Helpers image Crowd menu command, and drag in the viewport to create a Crowd object. Make the Crowd object big enough to be easily selected.
  3. Select the Create image Helpers image Delegate menu command, and drag in the Left viewport to create a Delegate object positioned outside the trees. Rotate the bunny to set its orientation, and then link the bunny to the delegate object. Then Shift+drag the delegate to create six total delegate bunnies positioned about the scene.
  4. Select the crowd object, click the New button in the Setup rollout of the Modify panel, select the Avoid behavior, and name it Avoid trees. In the Avoid Behavior rollout, click the Multiple Selection button. In the Select dialog box that appears, choose all tree objects and click the Select button. Enable the Display Hard Radius button, and then decrease the Hard Radius value to 0.2 so the bunnies can travel through the trees.
  5. Click the New button again. This time, select the Seek behavior and name it Seek hole. In the Seek Behavior rollout, click the None button and choose the red box object that represents the hole.
  6. In the Setup rollout, click the Behavior Assignment button to open the Behavior Assignment and Teams dialog box. Click the New Team button, select all delegate objects, and click OK. Then select the Team0 team and the Avoid cubes behavior, and click the center New Assignment button (the long, thin button with the right-pointing arrows). Select the Team0 team again with the Seek goal behavior, and click the New Assignment button again. Both assignments are listed in the center pane; click OK.
  7. Set the End Solve value equal to the animation length of 300 frames. In the Solve rollout, click the Solve button.

    The crowd system solves the movement of all delegates as they move toward the goal.

  8. Click the Play Animation button to see the resulting solution.

Figure 5 shows the position of the delegates after the simulation has ended. Notice the random position of the various delegates.

FIGURE 5 The Crowd simulation automatically figures out how to move the delegate bunnies to reach the goal while avoiding the trees.

image

Summary

The Crowd features of Character Studio are useful for animating the motion of delegates following specified behaviors. The following topics were covered:

  • Creating crowds with helper objects
  • Assigning behaviors
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.14.93