Setting Up Behaviors
 
 
 

In this lesson, you'll work with biped settings and behaviors to make the simulation solve correctly.

Set up this lesson:

Set delegates to use random start clips:

You can specify that biped/delegates should use either the first clip of the current script or a random start clip setting. When you first solve this simulation, none of the bipeds will have scripts, so you must choose the second option.

  1. Select the Crowd helper in the viewport.
  2. In the Modify panel > Setup rollout, click Multiple Delegate Editing.
  3. In the Edit Multiple Delegates dialog > Delegates To Edit group, click the Add button.
  4. In the Select dialog, click All and then Select. This selects all delegates for editing.
  5. In the Biped group, choose Random Start Clip and turn on its SET check box.

    Turning on SET indicates that this new setting should take effect when you click Apply Edit.

  6. Click the Apply Edit button at the bottom of the dialog.

Solve the simulation:

Adjust the behaviors:

  1. Select the Crowd helper.
  2. On the Modify panel > Setup rollout > Behaviors group, choose the Wander behavior.

    In the Wander Behavior rollout, the Period value sets the number of frames during which the delegate or biped should wander. Then the biped or delegate ceases wandering, and follows other behaviors in the simulation.

    When using the Wander behavior with biped crowds, the Period should be set to slightly longer than the average clip length. This gives the simulation enough time to choose an entire clip for the wandering period. Most clips in this simulation are about 90 frames long.

  3. In the Wander Behavior rollout, change the Period value to 100.

    To keep the father bipeds from clustering at the center, you can also reduce the weight of the behavior that causes them to seek the center box.

  4. In the Setup rollout, click Behavior Assignments.
  5. In the Behavior Assignments area, highlight the Seek Center Box behavior assigned to the Fathers team, and change the Weight value at the bottom of the dialog to 0.01. Click OK to close the dialog.

    This lower weight setting will make the father bipeds less likely to seek the center box, and more likely to wander.

  6. In the Solve rollout, click Solve.

    This time, the activity in the scene is more varied. The bipeds approach the center, walk away from the center, and come back, which is similar to the original movement of the delegates alone.

    However, the bipeds don't always avoid each other successfully; at times, they pass through one another. This happens because directional changes indicated by the delegate behaviors can be overridden by the motion clips guiding the biped animation. To avoid collisions, the biped motion must take precedence.

Set priorities:

To resolve the problem of biped collisions, you can set priorities for bipeds. This approach causes the crowd system to solve one biped's motion at a time. As each biped's motion is determined, subsequent bipeds can accurately predict the location of bipeds solved earlier, and choose clips in such a way that collisions will be avoided.

  1. Go to frame 0.

    The Browns, the three delegates at the top of the Top viewport, will have priority over the Blacks.

  2. Select the Crowd helper.
  3. On the Modify panel, at the bottom of the Priority rollout, turn on Display Priorities.

    In the viewport, each delegate displays the number 0. By default, the Priority value 0 is assigned to all delegates. You can change Priority assignments manually, picking delegates in the appropriate order.

    NoteDelegates with lower Priority values take precedence over those with higher values. Thus, for example, a delegate with Priority 0 goes before a delegate with Priority 1, and so on.
  4. In the Priority rollout > Assign By Picking group, click the Pick/Assign button.

    When this mode is turned on, you can pick only delegates in the scene.

  5. In the Top viewport, click the rightmost delegate in the top group.

    By default, you assign a Priority value of 0 to the first delegate you pick, so the number doesn't change.

  6. Pick the delegate to its left.

    The Priority value 1 appears next to the delegate.

  7. Continue to pick delegates in a counter-clockwise manner, ending with the rightmost delegate at the bottom of the Top viewport.

    The Brown family members now have priorities 0, 1, and 2, while the Blacks have 3, 4, and 5.

  8. Right-click in the viewport to turn off Pick/Assign.
    TipIf the priority numbers are obscured by the bipeds, you can check the priority assignments by selecting each delegate and checking its Priority value at the bottom of the Modify panel. If you do so, select the Crowd helper again before continuing.

    To enable Crowd to use priorities, you must turn the feature on.

  9. In the Solve rollout > Bipeds group, turn on Biped/Delegates Only, Use Priorities and Backtracking.

Solve the simulation:

  1. In the Modify panel > Solve rollout, turn on Update Display if it's turned off.
    NoteIf you are concerned about system performance, you can turn off Update Display for faster solution calculation.
  2. Set Frequency to 20.
  3. Click Solve to start the solution.

    This time, because Use Priorities is on, the solution proceeds one biped at a time. First, the Brown father heads toward the center, and then his child and wife join in, one at a time. During each subsequent sub-solution, you can see the previously solved delegates moving without their bipeds. Next, the Black father takes his turn, followed by the mother and child.

    At certain points during the solution calculation, you will see the time slider jump back to an earlier frame. This occurs when the system uses backtracking to avoid collisions.

    When the crowd system can't find a way to avoid a collision, and returns to the previous motion clip to try a different path through the motion flow network. If the crowd system can't avoid a collision by jumping back one clip, it jumps back again to look for a better path, and so on. You can see the time slider jump back during backtracking even when the Update Display option is turned off.

    TipIn a crowd simulation with more bipeds, you can also help prevent collisions by setting different start frames for each delegate. For example, delegates closer to the center of the scene can start moving before delegates farther away. You can set start frames individually for delegates by selecting a delegate and changing the Start Frame value on the Modify panel, or you can set them all at once by selecting the Crowd helper and clicking Modify panel > Priority rollout > Set Start Frames.
  4. Save your work as my_tut_biped_crowds04.max

Next

Creating Multiple BIP Files