This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

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.

Notice
The enabled and position callback functions should be implemented in the world script.
The trigger nodes can work with procedurally created world cluster and world clutter objects. For example, a trigger node can be added as a child to a node that is baked into a world cluster in order to fire theenabled callback when the cluster renders this node (i.e. enables it).

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

Lightning Node Enabled

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.

Place a Trigger Node

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:

Adding Trigger Node as a Child Node to a World Cluster

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.

Trigger Node Settings

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.

Notice
The callback function can also take 2 additional arguments. However, you can set such callbacks via the code only. Via UnigineEditor, you can only specify the callback functions that receive 0 or 1 argument.
Last update: 2017-07-03
Build: ()