On this page |
Overview
At each step in the simulation, Houdini looks at each agent and checks a series of trigger nodes (for example "distance to target > 2"). A logic node is available to combine triggers. If a trigger applies, Houdini checks for a transition attached to the trigger to change the agent to a new state (for example, "walk" → "run"). Transitions can have a duration during which Houdini will automatically blend the animation clips of the old and new states.
Adding a transition
Transitions control when an agent changes from one state (for example, walk
) to another (for example, idle
). A transition requires three decisions:
-
The state you want agents to transition out of.
-
The condition which should trigger the transition.
-
The state you want agents to transition into.
-
Go to the crowd simulation network.
-
Create a Crowd Trigger node. In the parameter editor, set up the trigger condition (see "built-in trigger types" below).
You can combine multiple triggers with "And", "Or", or "Not" logic using a Crowd Trigger Logic node.
-
Create a Crowd Transition node and wire trigger node into it.
-
In the parameter editor for the transition node, set the Start state and End state.
-
Wire the output of the transition node into the
transition_merge
node (see the crowd DOP network).
Built-in trigger types
The Crowd Trigger node includes many useful test types, as well as a Custom option that lets you write a test expression in VEX.
Trigger type |
What it does |
Example |
---|---|---|
Object bounds |
Activates when the agent enters, leaves, or is inside some geometry. |
Agents stop running when they cross the finish line of a race. |
Object attribute |
Activates based on the value of an attribute on some object near the agent. |
Agents stop when they're at a red light, and walk when they're at a green light (use a "stop" attribute on the light object and have agents check if "stop" is 1). |
Object distance |
Activates based on how near to or far from an object (or point in a point cloud) the agent is. |
Agents stop and turn around if they get too far from a base. |
Object ray cast |
Activates if an object is directly in front of an agent within a certain distance. |
If an agent sees a painting, they stop to admire it. |
Particle speed |
Activates based on the agent’s speed. |
Switch from a "walk" to a "run" to a "sprint" state/animation based on the agent’s speed. |
Particle proximity |
Activates based on the proximity of other agents. |
Agents from different groups switch to a "fight" state when they get close together. |
Particle attribute lookup |
Activates based on the on the value of one of the agent’s attributes |
Switch to a "dying" state if an agent’s "health" attribute gets too low. |
Particle attribute comparison |
Activates based on comparing the value of one of the agent’s attributes to the value of the same attribute on agents nearby |
Agents run away from bigger opponents. |
Time |
Activates based on the scene time (for example, if the current time step is more than 5 seconds into the scene) |
Agents start running halfway through the scene. |
Current state duration |
Activates based on how long the agent has been in its current state |
Guards leave the "alert" state after 30 seconds. |
Animated parameter |
Activates based on a parameter on the trigger node. You can keyframe the value of the parameter for manual control, or enter an expression to activate based on a function |
Agents react to hand-animated events in the rest of the scene. |
Custom VEXpression |
Activates based on the value of a variable after running a VEX snippet. The trigger activates if the |
Use this for more complex or custom requirements. |
Combining triggers
The Crowd Trigger Logic node lets you combine the results of two triggers using "and", "or", or "not" relations.
Tips
-
See agent attributes for useful attributes to use in custom triggers.
-
If multiple triggers/transitions activate for a given agent, which transition is chosen is technically undefined (but it’s probably the last transition in wiring order). However, it’s best to avoid this situation by not creating multiple trigger/transition paths with the same "from" state.
See also |