Create panel > Helpers > Object Type rollout > Crowd > Setup rollout > New button > Avoid Behavior
Select a Crowd object. > Modify panel > Setup rollout > New button > Avoid Behavior
The Avoid behavior lets you specify any object or objects that delegates must keep away from. As delegates approach designated objects during the crowd simulation, they steer clear of them while turning and/or braking as necessary. This behavior uses three different methods to let delegates avoid each other and other objects: Steer To Avoid, Repel, and Vector Field.
Steer to Avoid behavior is best used for animals that steer around each other at close proximity. Legged animals and fish typically do this. Steering motion may be sudden since its action is often engaged for relatively short periods of time.
By contrast, Repel avoidance behavior mimics the continuous action of a repellent magnetic field. Birds, bats and flying insects are best animated with large Repel fields so that they can smoothly avoid each other while maintaining a comfortable margin of error. Repel forces prevent intrusion from all sides, regardless of the direction of travel. Thus even animals that rely mainly on Steer to Avoid will also need some degree of Repel avoidance to maintain spatial separation when they are moving through dense traffic. The forces of Repel avoidance are always directed uniformly outward in a spherical shape.
Use Vector Field avoidance for cases where crowd members must avoid hitting the more complex shapes of arbitrary MAX objects. The outward forces of the Vector Field avoidance may constructed to form the shape of any MAX object. For example, suppose you want to animate a school of fish swimming around a sunken ship. In this case, a vector field can be created so that it extends the shape of the ship into the surrounding space. The field is computed by scan converting the ship's surface normals into a 3D lattice that surrounds the ship. These normals will extend into space as "beacons" in the 3D lattice, telling the fish how to best swim away from the shape of the ship. As the fish enters the space of the vector field lattice, it can be precisely repelled along an avoidance force directed away from ship's surface.
Note: In the explanations that follow, the word "target" is used to refer to the object or objects to be avoided.
To use the Avoid behavior
Add an Avoid behavior to the Crowd object.
In the Avoid Behavior rollout, use the None button or the Multiple Selection button to designate the target object or objects to avoid.
Tip: When avoiding multiple objects with a team, it's okay for an object to avoid itself.
Change the default settings as desired.
Use Behavior Assignments to assign the behavior to a delegate or team.
Avoid Behavior rollout
None (label): Specifies a single target. Click this button, and then click the target object in the viewport. The target name then appears on the button.
If you've selected multiple targets using Multiple Selection (see next item), the word Multiple appears on the button. To see which objects are designated as targets, click the Multiple Selection button.
Multiple Selection: Opens the Select dialog to let you designate multiple targets. When you have more than one target, you can set delegates to move toward the closest target in the group, or to a computed average of the target positions.
Look Ahead: The number of frames in advance of the current frame that the software looks for potential collisions. Default=30.
Hard Radius: Distance from the target's pivot point, in multiples of the delegate's bounding sphere, where no penetration should occur. Default=1.0.
Tip: Because the hard radius' center is the pivot point, Avoid may not work as expected with target objects whose pivot point is not centered, such as the box primitive. For best results, use the Hierarchy panel > Adjust Pivot rollout controls to center the pivot to the object.
Display Hard Radius: Enables display of a wireframe sphere that depicts the extent of the Hard Radius setting. Default=off.
Steer To Avoid group
Steer To Avoid is used by delegates to steer precisely around anticipated future collisions based on the delegates' current speed and direction. Delegates using this approach can pass very close to one another.
Detour Angle: Maximum necessary turning angle relative to the direction of delegate's goal that delegate will steer to avoid rather than slow down and wait. Default=360. Range=0-360.
Tip: To disable turning for avoidance, thus allowing only braking, set Detour Angle to 0. This forces delegates to remain directed toward their goal so that they must slow down and wait until there is a clearing in front of them, much like an audience queuing to leave through an exit after a concert.
Brake Pressure: Determines how strongly the brakes are applied. Higher values induce more gradual and slower stops, but may cause brakes to "pump" in order to slow down. A value of 0 disables the brakes. Default=2.0.
Repel is a general separation force that is based only on the spatial position. Delegates use this to keep from getting into situations where they might side-swipe each other or where they might get so close that Steer To Avoid is too difficult to achieve.
Strength: Determines the strength of the repelling force; higher values result in greater repulsion force. Default=0.2. Range=0.0 to 1.0.
Radius: Maximum distance from delegate's bounding sphere within which "repel" avoidance is sensed and carried out. Default=3.0.
Falloff: The rate at which the strength diminishes between the Repel radius and the hard radius. A value of 1.0 indicates a linear falloff. Higher values cause the strength to fall off to zero more rapidly with distance, thus focusing its effect closer to the delegate's hard radius. Lower values reduce the rate of diminishment, with a Falloff setting of 0.0 indicating that the strength is the same at the Radius distance as it is at the Hard Radius. Default=3.0.
Display Repel Radius: Enables display of a wireframe sphere that depicts the extent of the Repel setting. Default=off.
Vector Field group
If you've applied a Vector Field space warp to an object in your scene, you can specify the vector field as an object to avoid. The distinction is this: When used with the Space Warp behavior, delegates use the vector field to steer around the object by being guided to travel perpendicular to the field's vectors. When used with the Avoid behavior, the delegate simply moves away in the direction of the vectors.
Tip: Sometimes when using Avoid with a vector field, the behavior might seem to be "fighting" with other behaviors (such as Seek) over delegate movement, causing a halting and/or wavering motion. In such cases, try reducing Brake Strength and/or increasing Falloff.
Strength: Higher values result in more powerful influence. Delegates will be directed to move perpendicular to the field. Default=1.0. Range=0.0 to 1.0.
Falloff: Higher values cause vector field influence to fall off to zero more rapidly with distance, thus focusing its effect closer to the delegate's hard radius. Default=8.0.
Display During Solve group
Use these switches for debugging a crowd simulation. During the solve, they display information about the simulation using graphical metaphors for different aspects of the Avoid behavior.
Potential Collisions: Displays a green line from the delegate to the location of a potential collision. Default=off.
Repel Activity: Displays a white line between the delegate and target when the repel force is in effect. Default=off.
Look Ahead Radius: Displays a sphere that shows the current distance used to check for potential collisions.
Color Swatch: Shows the color used to draw the Avoid force vector during the solution. Click the box to choose a different color. Default=red.
Force: When on, force exerted on the delegate(s) by the Avoid behavior is drawn in the viewports as a colored line during the simulation solution. Default=on.