On this page |
Overview ¶
At each step in the crowd simulation, Houdini looks at every agent and checks a series of trigger conditions (for example, “distance to target > 2”). If a trigger applies, Houdini checks for a transition that is attached to the trigger to change the agent to a new state (for example, walk → run). Transitions can have a duration during which Houdini automatically blends the animation clips of the old and new states.
Adding triggers and transitions ¶
Transitions control when an agent changes from one state to another (for example, from “walk” to “idle”). A transition requires three decisions:
-
The state you want the agents to transition out of.
-
The condition that triggers the transition.
-
The state you want the agents to transition into.
By default, Houdini colors Crowd Trigger DOP nodes orange, and Crowd Transition DOP nodes blue.
-
In the crowd simulation network, create a Crowd Trigger DOP node.
-
On the Crowd Trigger DOP, set the trigger Type and the related trigger conditions.
-
Create a Crowd Transition DOP node. Wire the Crowd Trigger DOP into the Crowd Transition DOP.
-
On the Crowd Transition DOP, set the Input State and Output State.
-
Wire the output of the Crowd Transition DOP into the
merge_transitions
node.
Note
You can combine multiple triggers with “and”, “or”, and “not” logic using a Crowd Trigger Logic DOP.
Built-in trigger types ¶
The Crowd Trigger DOP includes many useful test types, as well as a Custom VEXpression 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 are at a red light, and walk when they are at a green light (use a |
Object distance |
Activates based on the agent’s distance from an object or point cloud. |
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 and 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 value of one of the agent’s attributes. |
Switch to a “dying” state if an agent’s |
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. |
RBD impact data |
Activates when an agent is hit by an object with an impact that is greater than the threshold. |
Agents turn into ragdolls when they are hit with arrows. |
Animation clip loops |
Activates based on the number of times the agent’s current animation clip has looped around. |
Agents start to run after jumping a certain number of times. |
Look At target |
Activates based on an agent’s current look at target. |
Agents start to walk after looking at a painting for 5 seconds. |
RBD sticky collisions |
Activates based on the number of sticky collisions that have occurred on that agent. |
Agents turn into ragdolls when hit by arrows that stick to them. |
Combining triggers ¶
The Crowd Trigger Logic DOP allows you to combine the results of two triggers using “and”, “or”, and “not” relations.
In the example below, agents in the “stand” state transition to the “walk” state after being in the state for a few seconds or after being hit with an RBD object.
Tips ¶
-
See agent attributes for useful attributes to use in custom triggers.
-
If multiple triggers/transitions activate for a given agent, the transition that is chosen is technically undefined (but is probably the last transition in the wiring order). However, it is best to avoid this situation by not creating multiple trigger/transition paths with the same “from” state.
See also |