This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
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.

NodeTrigger Class

Node Triggers are basically dummy nodes with additional functionality to fire callbacks when:

  • They are enabled/disabled (enabled callback function)
  • Their position is changed (position callback function)

For example, to detect if some node has been enabled (let's say, WorldClutter that renders nodes only around the camera has enabled it), NodeTrigger is added as a child of this node and fires a corresponding callback.

NodeTrigger Class

This class inherits from Node

Members


NodeTrigger ()

Constructor. Creates a new trigger node.

string getEnabledCallbackName ()

Returns the name of callback function to be fired on enabling the trigger node. This callback function is set via setEnabledCallbackName().

Return value

Name of the callback function.

string getPositionCallbackName ()

Returns the name of callback function to be fired on changing the trigger node position. This callback function is set via setPositionCallbackName().

Return value

Name of the callback function.

void setEnabledCallbackName (string name)

Sets a callback function to be fired when the trigger node is enabled. This function should accept a NodeTrigger that fired the callback as its first argument.

Arguments

  • string name - Name of the callback function.

Examples

Source code (UnigineScript)
NodeTrigger trigger;

// Implement a function that takes NodeTrigger as its first argument.
int enabled_callback_func(NodeTrigger trigger) {
	// Your callback code
	return 1;
}

// Set the callback to fire when NodeTrigger is enabled.
trigger.setEnabledCallbackName("enabled_callback_func");

void setEnabledCallback (variable function, variable arg0 = 0, variable arg1 = 0)

Sets a callback function to be fired when the trigger node is enabled. This function should accept a NodeTrigger that fired the callback as its first argument. In addition, it can also take any other two arguments.

Arguments

  • variable function - Name of the callback function.
  • variable arg0 = 0 - Argument to the function. This is an optional parameter.
  • variable arg1 = 0 - Argument to the function. This is an optional parameter.

Examples

Source code (UnigineScript)
NodeTrigger trigger;
MyClass arg0; // it can be an argument of any type

// Implement a function that takes NodeTrigger as its first argument.
// It can also take any other 2 arguments, if necessary.
int enabled_callback_func(NodeTrigger trigger, MyClass arg0) {
	// Your callback code
	return 1;
}

// Set the callback to fire when NodeTrigger is enabled.
trigger.setEnabledCallback("enabled_callback_func", arg0);

void setPositionCallbackName (string name)

Sets a callback function to be fired when the trigger node position has changed. This function should accept a NodeTrigger that fired the callback as its first argument.

Arguments

  • string name - Name of the callback function.

Examples

Source code (UnigineScript)
NodeTrigger trigger;

// Implement a function that takes NodeTrigger as its first argument.
int repositioned_callback_func(NodeTrigger trigger) {
	// Your callback code
	return 1;
}

// Set the callback to fire when NodeTrigger has changed its position.
trigger.setPositionCallbackName("repositioned_callback_func");

void setPositionCallback (variable function, variable arg0 = 0, variable arg1 = 0)

Sets a callback function to be fired when the trigger node position has changed. This function should accept a NodeTrigger that fired the callback as its first argument. In addition, it can also take any other two arguments.

Arguments

  • variable function - Name of the callback function.
  • variable arg0 = 0 - Argument to the function. This is an optional parameter.
  • variable arg1 = 0 - Argument to the function. This is an optional parameter.

Examples

Source code (UnigineScript)
NodeTrigger trigger;
MyClass arg0; // it can be an argument of any type

// Implement a function that takes NodeTrigger as its first argument.
// It can also take any other 2 arguments, if necessary.
int repositioned_callback_func(NodeTrigger trigger, MyClass arg0) {
	// Your callback code
	return 1;
}

// Set the callback to fire when NodeTrigger has changed its position.
trigger.setPositionCallback("repositioned_callback_func", arg0);
Last update: 2017-07-03
Build: ()