|On this page|
At any given time, every agent is in a certain state, for example “walk”, “idle”, “attack”, or “run_to_goal”. The state encapsulates behavior nodes. These nodes affect the agent primitive, such as moving it around or changing its attributes. How the forces inside the state are actually applied to agents in that state depends on weights.
Houdini animates agents in a given state using an animation clip with the same name as the state.
After each state, you can add particle DOP nodes to move agents in the state.
Houdini includes many “steering force” nodes that implement useful crowd behaviors such as “move toward a point” and “follow a path”. These are very similar to DOP particle nodes, and in fact you can use particle forces to affect agents as well, although plain particle forces do not have the concept of weights.
Add a new state
With the state node selected, in the parameter editor, set the State name parameter. This must correspond to the name of an animation clip. For example, agents will run the
walkanimation clip while in the
Adding behavior to a state
Create a node to influence the agent behavior (see below) and wire it into the simulation network:
Put it between a state node and the merge to have it apply only in that state.
Put it after the merge (between the merge and the solver) to have it apply to all agents in all states.
Note that no matter which way you wire it, you can use the Group parameter on a behavior node to limit it to a certain group or groups of agents.
You can have multiple behaviors in a state, multiple behaviors after the merge, and there are also behaviors built into the crowd solver that apply to all agents. The solver combines all the applicable forces using weights.
Houdini includes several useful POP forces created to work with crowds. Nodes of this types have names starting with “POP Steer”.
POP Steer Align makes an agent turn to align with other agents near it or 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 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 let expert users use a VOP network to calculate a force vector.
These “steering” forces are essentially particle forces with the added concept of a weights. You can use them with regular particles by setting their Output parameter to “POP force”.
You can also use regular particle simulation forces (for example, the POP Wind node) as behavior nodes. However, because those forces don’t have Weight parameters, the solver will add them directly instead of normalizing them with other forces.
Using the Path shelf tool
Select the path curve.
On the Crowds shelf tab, click the Path tool.
This tool creates the POP Steer Path node to make all agents follow the path. If you want only agents in a certain state to follow the path, you need to rewire the POP Steer Path node. See the simulation network overview and states and behaviors.
For more information on path following, see the help for the POP Steer Path node.
Using the Look At shelf tool
This tool simply wires an Agent Look At DOP into the current crowd network to make agents look at an object (either in one state or all states).
Select the object you want agents to look at.
On the Crowds shelf tab, click the Look At tool.
In the dialog box, enter the name of a state, or enter nothing to have the agents look at the object in all states.
Default agent behaviors on the solver
The Crowd Solver node has certain optional default behaviors, such as collision avoidance, that may apply to all agents regardless of state.
The solver constrains agents from turning or moving too fast while reacting to forces, to keep movement looking realistic.
The solver has optional default behaviors to keep agents from running into each other, and to avoid obstacles.
The solver has options to make agents “stick” to a terrain object, and to adapt foot bone placement to terrain.
Changing attributes inside a state
The “steering” behaviors are focussed on applying force to the agent particles to move them around. You can also change attributes on the agent using a POP Wrangle DOP as a behavior node.
For example, if you want to change an agent’s maximum turn rate when it’s in a certain state, use an Attribute Wrangle DOP inside the state 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 with “Agent” in the title are useful for working with agents.