This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Basics
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Trigger

A trigger is a zero-sized node that has no visual representation and triggers events when:

  • It is enabled/disabled (the Enabled event is triggered).
  • Its transformation is changed (the Position event is triggered).

The Node Trigger node is usually added as a child node to another node, so that the handler functions were executed on the parent node enabling/disabling or transforming.

Notice
The Enabled and Position event handlers should be implemented in the world script.

The Node Trigger can work with procedurally created World Clutter objects.

The Node Trigger can be used, for example, to play a sound of thunder when a lightning flashes: when the lightning node is enabled, the Enabled event handler that plays a sound is executed.

Lightning node enabled

See also#

Adding a Node Trigger#

To add a new Node Trigger via UnigineEditor do the following:

  1. Run UnigineEditor.
  2. On the Menu bar, click Create -> Logic -> Node Trigger.

  3. Place the Node Trigger in the world.
  4. Add the Node Trigger as a child to a node for which handlers should be executed: select the Node Trigger in the World Nodes Hierarchy window and drag it inside the required node.

Editing a Node Trigger#

To edit the Node Trigger, select it and go to the Node tab of the Parameters window.

Node Trigger settings

Handling Events#

Editing a trigger node includes implementing and specifying the Enabled and Position event handlers that are executed on enabling or positioning the Trigger node correspondingly.

The event handler must receive at least 1 argument of the NodeTrigger type. In addition, it can also take another 2 arguments of any type.

The event handlers are set via pointers specified when subscribing to the following events: Enabled and Position.

Source code (C++)
// subscribe to the Enabled event when the trigger is enabled
nodeTrigger->getEventEnabled().connect(enabled_event_handler);
// subscribe to the Position event when the trigger's transformation is changed
nodeTrigger->getEventPosition().connect(position_event_handler);
Source code (C#)
// subscribe to the Enabled event when the trigger is enabled
nodeTrigger.EventEnabled.Connect(enabled_event_handler);
// subscribe to the Position event when the trigger's transformation is changed
nodeTrigger.EventPosition.Connect(position_event_handler);
Last update: 2023-12-15
Build: ()