shown in other instead.
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
- 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 Nodes panel, hold Alt and drag it inside the required node. For example:
Editing a Trigger Node
To edit the trigger node, select it and go to the Trigger tab of the Nodes panel. 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. The enabled and position callback functions should receive a trigger node that fired the callback as its first argument. However, they can also receive no arguments.