Tutorial 8: Working with Crowd Animation
The Crowd object lets you assign behaviors to delegates. This lesson teaches you how to add these two objects and make them work together. You'll add a behavior and assign it to the smallest possible crowd: a single delegate.
Creating a delegate
On the Create panel, click Helpers.
In the Object Type rollout, click Delegate.
In the Top viewport, drag to add a Delegate helper object.
By default, the tip of the pyramid-shaped delegate object is its front; it helps to think of it as an arrowhead pointing in the direction it wants to go. Adding a delegate in the Top viewport points it forwards, in terms of the default world orientation.
Creating a crowd object
The Crowd helper object is available from the same rollout.
In any viewport, add a crowd object.
Delegate and Crowd helper objects in Top viewport
The size, position, and orientation of the crowd object are not important. Be sure to make it easily accessible, because you'll be selecting it frequently as you work with crowd simulation.
Tip: Create a selection set containing the crowd object to be able to select it quickly without using the viewports.
Adding a behavior
You'll add a behavior and apply it to the delegate. The easiest behavior to use is the Wander behavior.
Go to the Modify panel, which shows rollouts for the crowd object.
In the Setup rollout, click the New button.
In the Select Behavior Type dialog, choose the Wander behavior and click OK.
The default name of the behavior, Wander, appears in the list at the bottom of the Setup rollout, and a new Wander Behavior rollout appears in the command panel under the Setup rollout. You can find a full explanation of its parameters in the Wander Behavior.
When you have multiple behaviors in a scene, this rollout shows the type and parameters for the current behavior as indicated in the list.
Change the name of the Wander behavior by clicking in the list box and typing a new name, such as My Wander Behavior.
Tip: When a scene contains multiple behaviors of the same type, give them distinguishing names so you don't confuse them.
The name doesn't change in the behavior's rollout title. The rollout title always displays the name of the behavior type.
Assigning the behavior
Next, you'll apply the behavior to the delegate.
In the Setup rollout, click the Behavior Assignments button.
This dialog lets you group delegates into teams and assign behaviors and cognitive controllers to delegates and teams. We'll cover the more advanced functionality in further lessons; meanwhile, you can find reference material on the dialog in Behavior Assignments and Teams Dialog.
In the Behavior Assignments and Teams dialog > Assignment Design group, click the two list entries: Delegate01 and My Wander Behavior.
The New Assignment button, outlined in red
When you select both a delegate and a behavior, the New Assignment button becomes available. This vertical button, situated between the Assignment Design and Behavior Assignments group, displays a column of right-pointing arrows.
Click the New Assignment button.
The assignment is added to the list in the Behavior Assignments group. By default, it has the highest available Weight value of 1.0 and is active.
Close the dialog by clicking OK.
Solving the simulation
You're now ready to solve the simulation.
In the Crowd command panel > Solve rollout, click the Solve button.
The software solves the simulation, while the bar graph under the Solve button shows its progress. As a result, the delegate wanders randomly around on the world grid.
The wandering delegate's trajectory
Tip: You can see the delegate's trajectory by going to the Motion panel and clicking Trajectories.
Play the animation.
You might need to change viewport settings to see the delegate throughout the animation.
Experiment with the behavior and delegate settings and continue to solve. Remember that you must have the crowd object selected to see the various crowd parameters.
Here are some things to try:
Change the Period setting to adjust how long the delegate travels before it changes direction.
Change Seed to vary the random path.
Select the delegate, and in the Motion Parameters rollout, turn off Constrain to XY Plane. This lets the delegate wander in 3D space! Note that, to solve after you do this, you'll have to select the crowd object again.
Tip: To save time, turn on the Plug-in Keyboard Shortcut Toggle and then press the S key to run a solution when the Modify panel is active.
Now that you've learned the basic features of the crowd system, you can work with real crowds that contain more than a single delegate.
Lesson 2: Using Multiple Delegates and Behaviors