On this page |
Overview ¶
At any given time, every agent is in a particular state, such as “walk”, “idle”, “attack”, or “run_to_goal”. A state is defined by:
-
The animation clip that is played for the agents in that state.
-
Behavior nodes that affect the movement of the underlying particles that the agents are attached to.
-
Nodes that affect the agent’s skeletal animation, such as the Agent Look At DOP (adjusts the agent’s pose) and the Agent Clip Layer DOP (blends another animation clip on top of the “base” animation clip).
For example, in a “run” state, an animation clip would be played of an agent running. Without a behavior node, the agents would run in place. If a behavior node like POP Steer Separate is used, the agents would run away from each other.
In a crowd simulation network, an agent’s animation is defined in the Crowd State DOP, and the behavior and skeletal animation nodes are wired in after the Crowd State DOP. In the example below, the Crowd State DOP nodes are pink (this is the default Crowd State DOP node color), and the behavior nodes are colored blue.
Add a new state ¶
The name of a state, along with its associated animation clip, is defined by the Crowd State DOP.
-
In the crowd simulation network, create a Crowd State DOP node and wire it into the
merge_states
node. -
On the new Crowd State DOP, set the State Name parameter to the name of an animation clip. For example, agents in the
walk
state play thewalk
animation clip.
Note
Along with the animation clip settings, other ragdoll-related settings are also defined in the Crowd State DOP.
Add behaviors to a state ¶
Create a behavior node to influence the movement of the underlying particles that the agents are attached to. Wire this behavior node into the crowd simulation network after the Crowd State DOP as follows:
-
For the behavior to apply only to the agents in a particular state, put the behavior node between the state node and the
merge_states
node. -
For the behavior to apply to all agents in all states, put the behavior node after the
merge_states
node (before the crowd solver).
In the below network, the behavior nodes are colored blue. The POP Steer Wander behavior only applies to agents in the walk state, and the POP Steer Path behavior applies to agents in all states.
Note
Regardless of whether the behavior node is wired before or after the merge_states
node, you can use the Group parameter on a behavior node to limit the behavior to a certain group or groups of agents.
You can have multiple behaviors in a state, and multiple behaviors after the merge. There are also behaviors built into the crowd solver that apply to all agents. The crowd solver combines the effects of all the applicable behaviors using weights.
Movement behaviors ¶
Houdini has several useful POP forces that you could use as behavior nodes to control the movement of the underlying particles that the agents are attached to. Nodes of this type have names starting with “POP Steer”. These “steering” forces are essentially particle forces with the added concept of weights, which determine how the crowd solver deals with multiple forces on the agents.
-
POP Steer Align makes an agent turn to align with nearby agents or other agents in its field of view.
-
POP Steer Avoid makes an agent avoid nearby agents.
-
POP Steer Cohesion makes agents move toward each other.
-
POP Steer Obstacle makes agents avoid static objects.
-
POP Steer Path makes agents follow a path curve.
-
POP Steer Seek makes agents move toward a point.
-
POP Steer Separate makes agents move away from each other.
-
POP Steer Wander makes agents move around randomly.
-
POP Steer Custom allows users to use a VOP network to calculate a force vector.
You can use the above steering forces with regular particles by setting the steering force Output Attribute parameter to POP force. You can also use regular particle simulation forces (for example, the POP Wind node) as behavior nodes. However, because the regular particle simulation forces don’t have Weight parameters, the solver will simply add these forces to the other forces on the agent instead of first normalizing them.
Default agent behaviors on the crowd solver ¶
The Crowd Solver DOP has some optional default behaviors, such as collision avoidance, that may apply to all agents regardless of the state they are in:
-
To keep movement looking realistic, the solver keeps agents from turning or moving too quickly when reacting to forces.
-
The solver has optional default behaviors to avoid obstacles and keep agents from running into each other.
-
The solver has options to make agents “stick” to a terrain object, and to adapt foot bone placement to the terrain.
Using shelf tools ¶
Path shelf tool ¶
The Path shelf tool creates a POP Steer Path DOP node to make agents in the selected state follow a path curve.
-
Select the path curve.
-
On the Crowds shelf tab, click the Path tool.
-
From the dialog box, select the state (or all states) in which you want the agents to follow the path.
-
If you select a particular state, the POP Steer Path node will be wired between the state node and the
merge_states
node. -
If you select all states, the POP Steer Path node will be wired after the
merge_states
node.
-
Look At shelf tool ¶
The Look At shelf tool wires an Agent Look At DOP into the crowd network to make the agents look at an object.
-
Select the object you want agents to look at.
-
On the Crowds shelf tab, click the Look At tool.
-
From the dialog box, select the state (or all states) in which you want the agents to look at the object.
-
If you select a particular state, the Agent Look At node will be wired between the state node and the
merge_states
node. -
If you select all states, the Agent Look At node will be wired after the
merge_states
node.
-
Customize behaviors ¶
Change the attributes inside a state ¶
The “steering” behavior nodes apply forces to move the underlying particles that the agents are attached to. You can also use a POP Wrangle DOP as a behavior node to change the attributes on an agent.
For example, if you want to change an agent’s maximum turn rate when it is in a certain state, use a POP Wrangle DOP after the state node with a script such as:
f@maxturnrate = 15;
Custom steer force VOP network ¶
You can use the POP Steer Custom DOP to define a new steering behavior. It contains a VOP network you can use to add to or change the current force on the agent particle.
VOPs names that include “Agent” are useful for working with agents.