Assigning Behaviors
 
 
 

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:

TipIf you need custom behaviors, you can create your own with scripting.

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.

TipBehaviors are assigned generic names by default. It's a good idea to rename them with more meaningful descriptors; for example, "Seek Ball" or "Avoid Fire".

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.

Using 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.

Behavior Tips

A few helpful things to know about behaviors in character studio:

Procedures

Example: To use assign behaviors to delegates:

This example shows how to create a basic crowd simulation with delegates and behaviors.

  1. Start 3ds Max or reset 3ds Max.
  2. Add a Crowd object and one or more Delegate objects to the scene. In general, add delegates in the Top viewport so that they point forward. The Crowd object's location is immaterial.
  3. Select the Crowd object and go to the Modify panel.
  4. On the Setup rollout Behaviors group, click the New button.
  5. In the Select Behavior Type dialog, click a behavior and then click OK to close the dialog.

    A Behavior rollout appears for the behavior you chose.

  6. If the behavior requires a target object or objects, such as Seek, click the None button and then select an object, or click Multiple Selection and select several objects.
  7. Change other behavior settings as necessary.
  8. Create and modify additional behaviors as necessary.
  9. On the Setup rollout, click (Behavior Assignment).
  10. In the Assignment Design group, the two upper lists should each contain a single entry: the delegate on the left, and the behavior on the right. Select both items.
  11. Click the New Assignment button to the right of the Assignment Design group. It's a vertical button with five right-pointing arrows.

    This adds the new assignment to the list in the Behavior Assignments group.

  12. Accept the changes and the OK button to close the Behavior Assignments and Teams dialog.
  13. On the Modify panel, scroll down to the Solve rollout and click the Solve button.

    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.