Behavior Triggers
Creating a CrowdTrigger can be performed through the following options:
- Crowd Shelf:
- Crowd Menu: CrowdTrigger Node
- MEL command: glmCrowdTriggerNodeCmd;
Note that most often it is useless to create a Trigger manually because two triggers will be automatically created when creating a Behavior.
Configuration
General Attributes

Trigger Operator | Multiple trigger attributes can be activated in a Trigger. The trigger operator is the operator used to aggregate all trigger attribute results and compute the final result of the Trigger (e.g. if the AND operator is used and 3 trigger attributes are activated, then the Trigger result is [Trigger1 AND Trigger2 AND Trigger3], meaning that it will not return true until all the triggers are not true at the same time). The available operators are AND, OR, XOR. |
Trigger Attributes

Random Trigger |
The Random Trigger enables to start or stop a behavior by returning true X times on Y frames.
Note that if 1000 characters use this trigger over 1000 frames, to have around one character starting the behavior over the whole sequence, one should use X=1, Y=1000.
This attribute is influenced by the random seed of the Crowd Manager
|
Current Frame Trigger |
The Current Frame Trigger enables to start or stop a behavior by returning true if the current frame is successfully compared to a reference value. There are two input values:
|
Zone Trigger |
The zone trigger enables to start or stop a behavior by returning true when the position of a particle representing an Entity is contained in a zone (the zone being represented by a Maya mesh). There are three input values:
This trigger can be useful to create a wave in a stadium, or to have characters jumping when crossing a small river.
|
Distance Trigger |
The distance trigger enables to start or stop a behavior by returning true when the distance between a particle representing an Entity and an object (camera, mesh…) is successfully compared to a reference value. There are three input values:
|
Driven Attribute Trigger |
The Driven Attribute Trigger enables to start or stop a behavior by returning true if any Maya object attribute is successfully compared to a reference value. There are three input values:
To link a Maya object attribute with the driven attribute:
It can be particularly useful to adapt a behavior to the environment or any event in Maya. E.g. one could create an explosion particle system, link its visibility attribute to a flee behavior. Then, when the explosion object will be displayed, the entities will flee from it. |
PPAttribute Trigger |
The PPAttribute Trigger enables to start or stop a behavior by returning true if a per-particle field is successfully compared to a reference value. There are three input values:
|
Behavior Time Trigger |
The motion time trigger enables to stop a behavior by returning true when a motion has been played for a certain amount of time. There are 3 input values:
The resulting time for testing is the sum of the percent parameter, the seconds parameter and the frames parameter.
This trigger has no meaning as a starting trigger, as the behavior has not yet run.
The % mode has meaning only for the Motion Behavior.
|
Script Cmd Trigger |
The script command trigger enables to start or stop a behavior by returning true when the MEL or Python command returns a value different than 0. There is only one possible input value, which is a string representing the script command.
This trigger can be useful when dealing with complex conditions or to execute a specific MEL or Python code during the simulation. The script command may contain two special tags (#pid# and #ps#) to interact with particles (see Technical Documentation ).
For example, if the user defines the function:
global proc int startBehavior(string $particleSystem, int $particleId)
To call this function with the current particle, the MEL command to use is; startBehavior("#ps#", #pid#)
|
True/False triggers |
True: Always returns true. It is the default starting trigger of each behavior (i.e. a behavior always starts); False: Never returns true. It is the default stopping trigger of each behavior (i.e. a behavior never stops); |
Callback Attributes

Trigger Hierarchy Attributes

- isInCriticalZoneTrigger: returns true if the soldier is close enough or inside the enemy base;
- someoneDetectedTriggerNode: returns true if someone is near the machine gun located at the center of the base;


