Trigger
A trigger is a zero-sized node that has no visual representation and fires callbacks when it is enabled/disabled (an enabled callback function is called) or its transformation is changed (a position callback function is called). The trigger node is usually added as a child node to another node, so that the callbacks will be fired on the parent node enabling/disabling or transforming.
The trigger node can be used, for example, to play a sound of thunder when a lightning flashes: when a lightning node is enabled, the enabled callback function that plays a sound is called
See also
- A NodeTrigger class to edit triggers via UnigineScript
Adding a Trigger Node
To add a new trigger node via UnigineEditor, click Create -> Node -> Trigger on the Menu bar and then place the trigger node in the world.
Then you should add the trigger node as a child to a node for which callbacks should be fired: select the trigger node in the World Hierarchy window and drag it inside the required node.
Editing a Trigger Node
To edit the trigger node, select it and go to the Node Trigger tab of the Parameters window. On this tab, you can specify the callback functions that will be called when the node trigger or its parent node is enabled/disabled or transformed.
The callback functions must be implemented in the world script (on UnigineScript side). The enabled and position callback functions should receive a trigger node that fired the callback as its first argument. However, they can also receive a node or even no arguments at all.