In the real world, different crowds exhibit diverse behaviors, and even members of the same crowd can conduct themselves in various ways. Included with the character studio Crowd system is an assortment of behaviors that let you simulate a range of crowd activities.
Behaviors let you assign procedural activity types to delegates, which, in turn, affect objects linked to delegates. You can associate any number of behaviors with each crowd object, and then link delegates and teams of delegates to each behavior. A specific behavior assigned to a Crowd object belongs only to that crowd; it cannot be assigned to any other crowds.
Following is a list of available behaviors:
The first time you add a behavior to the scene, a new rollout appears for the behavior below the Setup rollout. This rollout lets you change settings for the behavior. Certain behaviors, such as Seek and Avoid, let you specify "target" objects.
To display the rollout for a different behavior in the scene, choose it from the drop-down list in the Behaviors group. To see the controls available in the rollout for a behavior type, follow the link from its entry in the above list.
In addition to the controls available in behavior rollouts, you can use the Behavior Assignments and Teams dialog to turn behaviors on and off (with the Active check box), and for all behaviors except Avoid, Orientation, and Surface Follow, you can set and animate Weight. The Active status is animatable for all behaviors.
To use a behavior, you apply it to a delegate or a team of delegates using the Behavior Assignments and Teams dialog. In this dialog, each assignment of a behavior to a delegate is given a weight. You can modify and/or animate these weights to influence the simulation.
Behavior assignment weights can profoundly effect a simulation. When applying two or more behaviors to the same delegate, the weights define the relationship between the behaviors, making one more or less powerful than the other. One way to visualize a behavior assignment weight is to examine the behavior’s force vector during a crowd simulation. The vector’s length indicates the behavior’s weight upon the delegate.
Each behavior has its own parameters which appear in the Behavior rollout, available in the Crowd object’s Modify panel. These parameters describe how the behavior works, and can sometimes contribute to the behavior’s strength as well. For instance, Seek, Repel, Wall Seek, and Wall Repel, all have specific volumes of influence. Outside these volumes they have no effect and essentially have a weight of zero. This rollout lets you specify whether or not you wish to see behavior’s force vector dynamically displayed during a Crowd simulation, and what color that vector should be.
When working with the Crowd system, it is critical to play with behavior assignment weights, as well as each behaviors’ parameters. Typically, you run the simulation repeatedly, changing the weights and parameters to get the desired result.
A few behaviors cannot be weighted. These are Avoid, Surface Follow, and Orientation. Avoid and Surface Follow take over after all of the other behaviors have been applied to a delegate. They can take stringent measures to affect the delegate, possibly overpowering other behaviors in order to meet their constraints. Orientation simply sets the delegate's facing direction. It cannot be weighted and does not apply a force.
A few helpful things to know about behaviors in character studio:
One particularly useful feature of the delegate is its ability to display, using colored vectors, the strength and direction of the various forces acting upon it during solution of the crowd simulation. Each force can have a unique, identifying color. For example, the Seek behavior uses green by default, while the Wander behavior uses aqua. You can change these colors to any you like.
If a simulation isn't proceeding as expected, you can debug it by observing the vectors during the solution. And if the solution occurs too quickly, you can use the Step Solve feature to solve the simulation one frame at a time.
Example: To use assign behaviors to delegates:
This example shows how to create a basic crowd simulation with delegates and behaviors.
This adds the new assignment to the list in the Behavior Assignments group.
Keys are created as follows: The delegate turns to point toward the sphere, banking as it turns, and then moves directly toward the sphere. When it reaches its target, it moves slightly beyond the sphere, and then repeats the turn-and-move motion until the end of the simulation. To prevent this, try starting with the two objects farther apart, or animating the sphere's position.