This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
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
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
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.

Unigine.Node Class

In terms of Unigine, all of the objects added into the scene are called nodes. Nodes can be of different types, determining their visual representation and behavior.

The node is created and stored in the world. All changes are saved into the .world file.

The node can be also saved into an external .node file and then imported into the world when necessary. Also it is possible to create a reference to the exported node.

You can associate any string data (written directly into a *.node or a *.world file) or an arbitrary user variable with a node.

See Also#

Creating a Node#

The Node class doesn't provide creating of a node. You can create an instance of any class inherited from the Node class and then obtain the node via the getNode() method.

For example:

  1. Create a box mesh by using the Mesh class.
  2. Use the box mesh to create an instance of the ObjectMeshStatic class. This class is inherited from the Node class.
  3. Get the node from the ObjectMeshStatic instance via the getNode() method.
Source code (C#)
// AppWorldLogic.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Unigine;

namespace UnigineApp
{
    class AppWorldLogic : WorldLogic
    {

        public override int init()
        {

            // create a mesh
            Mesh mesh = new Mesh();
            mesh.addBoxSurface("box_0", new vec3(1.0f));
            // create an instance of any class inherited from the Node class (e.g. ObjectMeshStatic)
            ObjectMeshStatic object_mesh = new ObjectMeshStatic(mesh);

            // declare a node and obtain the node from the created ObjectMeshStatic
            Node node = object_mesh.getNode();

            return 1;
        }
	}
}

Now you can operate the ObjectMeshStatic instance as a node.

Editing a Node and Saving Changes#

The Node class contains common settings of the node. Also each node has special settings, which vary depending on the type of the node.

Notice
The special settings of a node can be found in the article on the corresponding class.

Editing the node also includes editing materials and properties assigned to the node.

For the edited node to be saved in the .world file, it should be added to UnigineEditor first: you should pass node ownership to the editor by releasing script ownership and call the addNode() method of the Editor class.

For example:

  1. Create a box mesh by using the Mesh class.
  2. Save the mesh on the disk. It is required as the node we are going to save to the .world file need to reference to a mesh stored on the disk.
  3. Use the saved .mesh file to create an instance of the ObjectMeshStatic class. This class is inherited from the Node class.
  4. Release script ownership of the ObjectMeshStatic instance.
  5. Get the node from the ObjectMeshStatic instance via the getNode() method.
  6. Add the node to UnigineEditor.
  7. Edit the node and save the world by calling the world_saveconsole command.
Source code (C#)
// AppWorldLogic.cs

using Unigine;

#if UNIGINE_DOUBLE
using Vec3 = Unigine.dvec3;
using Vec4 = Unigine.dvec4;
using Mat4 = Unigine.dmat4;
#else
    using Vec3 = Unigine.vec3;
    using Vec4 = Unigine.vec4;
    using Mat4 = Unigine.mat4;
#endif

namespace UnigineApp
{
	class AppWorldLogic : WorldLogic
	{

		public override int init()
		{
			// create a mesh
	        Mesh mesh = new Mesh();
	        mesh.addBoxSurface("box_0",new vec3(1.0f));
			// save a mesh into a file on the disk
	        mesh.save("unigine_project/meshes/my_mesh.mesh");
	        // declare a smart pointer for any type of the node inherited from the Node class (e.g. ObjectMeshStatic)
	        // and call a constructor of the corresponding class
	        ObjectMeshStatic object_mesh = new ObjectMeshStatic(mesh);
	        ObjectMeshStatic object_mesh = new ObjectMeshStatic("unigine_project/meshes/my_mesh.mesh");
	        // assign a material to the mesh
	        object_mesh.setMaterial("mesh_base","*");

	        // declare a smart pointer for the node
	        // and obtain the node pointer from the created NodeDummy
	        Node node = object_mesh.getNode();

	        // change the node name
	        node.setName("my_node");
	        // change node transformation
	        node.setWorldTransform(MathLib.translate(new Vec3(0.0f, 0.0f, 2.0f)));

	        // save node changes in the .world file
	        Unigine.Console.get().run("world_save");

			return 1;
		}
	}
}

Exporting and Importing a Node#

To export a node stored in the world into the external .node file, you should pass it to the saveNode() method of the World class.

To import the existing node stored in the .node file to the world, you should call the loadNode() method of the World class.

For example:

  1. Create a box mesh by using the Mesh class.
  2. Save the mesh on the disk. It is required as the node we are going to export need to reference to a mesh stored on the disk.
  3. Use the saved .mesh file to create an instance of the ObjectMeshStatic class. This class is inherited from the Node class.
  4. Release script ownership of the ObjectMeshStatic instance.
  5. Get the node from the ObjectMeshStatic instance via the getNode() method and Pass node ownership to the editor by adding it the node to it.
  6. Export the node to an external .node file.
  7. Import the prevoiusly exported node and add it to the editor to check the result.
    Notice
    The node imported via loadNode() is orphan, so you don't need to release script ownership.
Source code (C#)
// AppWorldLogic.cs

using Unigine;

#if UNIGINE_DOUBLE
using Vec3 = Unigine.dvec3;
using Vec4 = Unigine.dvec4;
using Mat4 = Unigine.dmat4;
#else
    using Vec3 = Unigine.vec3;
    using Vec4 = Unigine.vec4;
    using Mat4 = Unigine.mat4;
#endif

namespace UnigineApp
{
	class AppWorldLogic : WorldLogic
	{

		public override int init()
		{

            // create a mesh
	        Mesh mesh = new Mesh();
	        mesh.addBoxSurface("box_0", new vec3(1.0f));
	        // save a mesh into a file on the disk
	        mesh.save("unigine_project/meshes/my_mesh.mesh");
	        // create an instance of any class inherited from the Node class (e.g. ObjectMeshStatic)
	        ObjectMeshStatic object_mesh = new ObjectMeshStatic("unigine_project/meshes/my_mesh.mesh");
	        // assign a material to the mesh
	        object_mesh.setMaterial("mesh_base", "*");

	        // declare a smart pointer for the node
	        // and obtain the node pointer from the created NodeDummy
	        Node node = object_mesh.getNode();

	        // export the node into a .node file
	        World.get().saveNode("unigine_project/nodes/my_node.node", node);
	        // import the exported node to check the result
	        Node imported_node = World.get().loadNode("unigine_project/nodes/my_node.node");

	        // set a position of the node
	        imported_node.setPosition(new Vec3(4.0f, 0.0f, 1.0f));

			return 1;
		}
	}
}

Deleting a Node#

To delete a node owned by UnigineEditor, pass it to the removeNode() method of the World class.

Source code (C#)
// AppWorldLogic.cs

using Unigine;

#if UNIGINE_DOUBLE
using Vec3 = Unigine.dvec3;
using Vec4 = Unigine.dvec4;
using Mat4 = Unigine.dmat4;
#else
    using Vec3 = Unigine.vec3;
    using Vec4 = Unigine.vec4;
    using Mat4 = Unigine.mat4;
#endif

namespace UnigineApp
{
	class AppWorldLogic : WorldLogic
	{
		public override int init()
		{

            // create a mesh
	        Mesh mesh = new Mesh();
	        mesh.addBoxSurface("box_0", new vec3(1.0f));
	        // create an instance of any class inherited from the Node class (e.g. ObjectMeshStatic)
            ObjectMeshStatic object_mesh = new ObjectMeshStatic(mesh);
	        // assign a material to the mesh
	        object_mesh.setMaterial("mesh_base", "*");
	        // declare a smart pointer for the node
	        // and obtain the node pointer from the created NodeDummy
	        Node node = object_mesh.getNode();

	        // pass node ownership to the editor by adding the node to it
	        Editor.get().addNode(node);

            // do something with the node
            // ...

            // delete the node from the editor
            Editor.get().removeNode(node);

            // clear the mesh
            mesh.clear();

			return 1;
		}
	}
}

Node Class

Enums

CALLBACK#

NameDescription
PROPERTY_NODE_ADD = 0Node property added callback. This callback is fired when a new property is assigned to the node.
PROPERTY_NODE_SWAP = 1Node property swapped callback. This callback is fired when two properties swap their positions in the list of node's properties.
PROPERTY_NODE_REMOVE = 2Node property removed callback. This callback is fired when a property is removed from the list of node's properties.
PROPERTY_CHANGE_ENABLED = 3Callback to be fired on changing node's property enabled state. Callback function signature is as follows:
Source code (C#)
void Func(Node node, Property prop, int prop_num);
PROPERTY_SURFACE_ADD = 4Surface property added callback. This callback is fired when a property is assigned to object's surface.
PROPERTY_SURFACE_REMOVE = 5Surface property removed callback. This callback is fired when a property is removed from object's surface.
PROPERTY_NODE_SLOTS_CHANGED = 0
CACHE_NODE_ADD = 6Callback to be fired on adding a node to cache. Occurs once upon calling NodeReference.create() or World.LoadNode() :
Source code (C#)
NodeReference n = new NodeReference(“path.node”);
// or
World.LoadNode(“path.node”, 1 /* cache */);
Callback function signature is as follows:
Source code (C#)
void Func(Node node)
, where node - is a node added to cache.
Notice
Fired only for the root node. If a nested node reference is loaded, the callback shall be fired for the node at the top of the hierarchy only, the one created by the user.
NODE_LOAD = 7Callback to be fired on loading a node from a file. Callback function signature is as follows:
Source code (C#)
void Func(Node node);
NODE_CLONE = 8Callback to be fired on copying a node via Node.Clone():
Source code (C#)
node.Clone();
Callback function signature is as follows:
Source code (C#)
void Func(Node node_clone, Node node_original)
Notice
Fired only for the root node.
NODE_SWAP = 9Callback to be fired on swapping a node via Node.Swap():
Source code (C#)
node.Swap();
Callback function signature is as follows:
Source code (C#)
void Func(Node node_clone, Node node_original)
Notice
Fired only for the root node.
NODE_REMOVE = 10Callback to be fired on deleting a node. Callback function signature is as follows:
Source code (C#)
void Func(Node node);
Notice
Fired for each deleted node.
NODE_CHANGE_ENABLED = 11Callback to be fired on changing node's enabled state. Callback function signature is as follows:
Source code (C#)
void Func(Node node);
Notice
Fired for each node that has changed its enabled state. Changing the state of the root node, causes the callback to be fired for all its children as well.

TYPE#

NameDescription
NODE_BEGIN = 0Begin of the nodes range.
NODE_DUMMY = 0Dummy node. See the NodeDummy class.
NODE_LAYER = 1Layer node. See the NodeLayer class.
NODE_PIVOT = 2Pivot node. See the NodePivot class.
NODE_TRIGGER = 3Node trigger. See the NodeTrigger class.
NODE_REFERENCE = 4Node reference. See the NodeReference class.
NODE_EXTERN = 5Extern node. See the NodeExtern class.
NODE_END = 5End of the nodes range.
WORLD_BEGIN = 6Begin of the world nodes range.
WORLD_LAYER = 6World layer. See the WorldLayer class.
WORLD_SECTOR = 7World sector. See the WorldSector class.
WORLD_SPLINE_GRAPH = 8World spline graph. See the WorldSplineGraph class.
WORLD_PORTAL = 9World portal. See the WorldPortal class.
WORLD_TRIGGER = 10World trigger. See the WorldTrigger class.
WORLD_CLUSTER = 11Node cluster. See the WorldCluster class.
WORLD_CLUTTER = 12World clutter. See the WorldClutter class.
WORLD_SWITCHER = 13Node switcher (to switch off parts of the world). See the WorldSwitcher class.
WORLD_OCCLUDER = 14World occluder. See the WorldOccluder class.
WORLD_OCCLUDER_MESH = 15World mesh occluder. See the WorldOccluderMesh class.
WORLD_OCCLUDER_TERRAIN = 16World terrain occluder. See the WorldOccluderMesh class.
WORLD_TRANSFORM_PATH = 17Path defined transformer. See the WorldTransformPath
WORLD_TRANSFORM_BONE = 18Bone defined transformer. See the WorldTransformBone class.
WORLD_EXPRESSION = 19Node which allows to execute arbitrary expression. See the WorldExpression class.
WORLD_EXTERN = 20External world. See the WorldExtern class.
WORLD_END = 20End of the world nodes range.
GEODETIC_BEGIN = 21Begin of the geodetic nodes range.
GEODETIC_PIVOT = 21Geodetic Pivot node. See the GeodeticPivot class.
GEODETIC_END = 21End of the geodetic nodes range.
FIELD_BEGIN = 22Begin of the field nodes range.
FIELD_SPACER = 22Field Spacer node. See the FieldSpacer class.
FIELD_ANIMATION = 23Field Animation node. See the FieldAnimation class.
FIELD_HEIGHT = 24Field Height node. See the FieldHeight class.
FIELD_SHORELINE = 25Field Shoreline node. See the FieldShoreline class.
FIELD_WEATHER = 26Field Weather node. See the FieldWeather class.
FIELD_END = 26End of the field nodes range.
LIGHT_BEGIN = 27Begin of the light nodes range.
LIGHT_VOXEL_PROBE = 27Voxel probe. See the LightVoxelProbe class.
LIGHT_ENVIRONMENT_PROBE = 28Environment probe. See the LightEnvironmentProbe class.
LIGHT_OMNI = 29Omni-directional light source. See the LightOmni class.
LIGHT_PROJ = 30Projected light source. See the LightProj class.
LIGHT_WORLD = 31World light source. See the LightWorld class.
LIGHT_END = 31End of the light nodes range.
DECAL_BEGIN = 32Begin of the decal nodes range.
DECAL_PROJ = 32Projected decal node. See the DecalProj class.
DECAL_ORTHO = 33Orthographic decal node. See the DecalOrtho class.
DECAL_MESH = 34Mesh decal node. See the DecalMesh class.
DECAL_END = 34End of the decal nodes range.
OBJECT_BEGIN = 35Begin of the object nodes range.
OBJECT_DUMMY = 35Dummy object. See the ObjectDummy class.
OBJECT_DYNAMIC = 36Dynamic object. See the ObjectDynamic class.
OBJECT_MESH_STATIC = 37Static mesh object. See the ObjectMeshStatic class.
OBJECT_MESH_CLUSTER = 38Mesh Cluster object. See the ObjectMeshCluster class.
OBJECT_MESH_CLUTTER = 39Mesh Clutter object. See the ObjectMeshClutter class.
OBJECT_MESH_SKINNED = 40Skinned mesh object. See the ObjectMeshSkinned class.
OBJECT_MESH_DYNAMIC = 41Dynamic mesh object. See the ObjectMeshDynamic class.
OBJECT_MESH_SPLINE_CLUSTER = 42Mesh Spline Cluster object. See the ObjectMeshSplineCluster class.
OBJECT_TERRAIN = 43Terrain object. See the ObjectTerrain class.
OBJECT_TERRAIN_GLOBAL = 44Terrain global object. See the ObjectTerrainGlobal class.
OBJECT_GRASS = 45Grass. See the ObjectGrass class.
OBJECT_PARTICLES = 46Particles object. See the ObjectParticles class.
OBJECT_BILLBOARDS = 47Billboards object for rendering a high number of billboards. See the ObjectBillboard class.
OBJECT_VOLUME_BOX = 48Volume box object. See the ObjectVolumeBox class.
OBJECT_VOLUME_SPHERE = 49Volume sphere object. See the ObjectVolumeSphere class.
OBJECT_VOLUME_OMNI = 50Volume omni light object. See the ObjectVolumeOmni class.
OBJECT_VOLUME_PROJ = 51Volume projected light object. See the ObjectVolumeProj class.
OBJECT_GUI = 52GUI object. See the ObjectGui class.
OBJECT_GUI_MESH = 53GUI mesh object. See the ObjectGuiMesh class.
OBJECT_WATER_GLOBAL = 54Water global object. See the ObjectWaterGlobal class.
OBJECT_WATER_MESH = 55Water mesh object. See the ObjectWaterMesh class.
OBJECT_SKY = 56Sky object. See the ObjectSky class.
OBJECT_CLOUD_LAYER = 57Cloud layer object. See the ObjectCloudLayer class.
OBJECT_EXTERN = 58Extern object. See the ObjectExtern class.
OBJECT_TEXT = 59Text object. See the ObjectText class.
OBJECT_END = 59End of the object nodes range.
PLAYER_BEGIN = 60Begin of the player nodes range.
PLAYER_DUMMY = 60Dummy player. See the PlayerDummy class.
PLAYER_SPECTATOR = 61Observing player. See the PlayerSpectator class.
PLAYER_PERSECUTOR = 62Persecuting player. See the PlayerPersecutor class.
PLAYER_ACTOR = 63Acting player. See the PlayerActor class.
PLAYER_END = 63End of the player nodes range.
PHYSICAL_BEGIN = 64Begin of the physical nodes range.
PHYSICAL_WIND = 64Physical wind object. See the PhysicalWind class.
PHYSICAL_FORCE = 65Physical force node that allows to simulate point forces applied to dynamic objects. See the PhysicalForce class.
PHYSICAL_NOISE = 66Physical noise node that allows to simulate force field. See the PhysicalNoise class.
PHYSICAL_WATER = 67Physical water object that has no visual representation. See the PhysicalWater class.
PHYSICAL_TRIGGER = 68Physical trigger. See the PhysicalTrigger class.
PHYSICAL_END = 68End of the physical nodes range.
NAVIGATION_BEGIN = 69Begin of the navigation nodes range.
NAVIGATION_SECTOR = 69Sector within which pathfinding is performed. See the NavigationSector class.
NAVIGATION_MESH = 70Mesh-based navigation area across which pathfinding is performed. See the NavigationMesh class.
NAVIGATION_END = 70End of the navigation nodes range.
OBSTACLE_BEGIN = 71Begin of the obstacle nodes range.
OBSTACLE_BOX = 71Obstacle in the shape of a box avoided by pathfinding. See the ObstacleBox class.
OBSTACLE_SPHERE = 72Obstacle in the shape of a sphere avoided by pathfinding. See the ObstacleSphere class.
OBSTACLE_CAPSULE = 73Obstacle in the shape of a capsule avoided by pathfinding. See the ObstacleCapsule class.
OBSTACLE_END = 73End of the obstacle nodes range.
SOUND_BEGIN = 74Begin of the sound nodes range.
SOUND_SOURCE = 74Sound source. See the SoundSource class.
SOUND_REVERB = 75Sound reverberation zone. See the SoundReverb class.
SOUND_END = 75End of the sound nodes range.
NUM_NODES = 76Counter of node types.
NUM_WORLDS = WORLD_END - WORLD_BEGIN + 1Counter of world node types.
NUM_GEODETICS = GEODETIC_END - GEODETIC_BEGIN + 1Counter of geodetic node types.
NUM_FIELDS = FIELD_END - FIELD_BEGIN + 1Counter of field node types.
NUM_LIGHTS = LIGHT_END - LIGHT_BEGIN + 1Counter of light node types.
NUM_DECALS = DECAL_END - DECAL_BEGIN + 1Counter of decal node types.
NUM_OBJECTS = OBJECT_END - OBJECT_BEGIN + 1Counter of object node types.
NUM_PLAYERS = PLAYER_END - PLAYER_BEGIN + 1Counter of player node types.
NUM_PHYSICALS = PHYSICAL_END - PHYSICAL_BEGIN + 1Counter of physical node types.
NUM_NAVIGATIONS = NAVIGATION_END - NAVIGATION_BEGIN + 1Counter of navigation node types.
NUM_OBSTACLES = OBSTACLE_BEGIN - OBSTACLE_END + 1Counter of obstacle node types.
NUM_SOUNDS = SOUND_END - SOUND_BEGIN + 1Counter of sound node types.
DUMMY = 0Dummy node. See the NodeDummy class.
LAYER = 1Node layer containing parent layer and all its child nodes. See the NodeLayer class.
PIVOT = 2Node that helps to control rotation and transformation of its children. See the NodePivot class.
TRIGGER = 3Dummy node that can fire callbacks on its enabling/disabling or repositioning. See the NodeTrigger class.
REFERENCE = 4Node that references an external NODE file. See the NodeReference class.
EXTERN = 5Extern node.

Properties

GeodeticPivot GeodeticPivot#

A pointer to geodetic pivot of the node.

Variable Variable#

Returns the single unnamed variable parameter of the node.
set
Sets the value of the single unnamed variable parameter of the node. If this variable does not exist it will be created with a specified value.
set value - Variable value.

vec3 WorldScale#

The node scale in the world space.
set
Sets the node scale in the world space.
Notice
Scaling of nodes should be avoided whenever possible as it requires addidional calculations and may lead to error accumulation.
set value - Node scale in the world space.

Vec3 WorldPosition#

The node position in the world coordinates.
set
Sets the node position in the world coordinates.
set value -

vec3 Scale#

The scale of the node.
set
Sets the scale of the node.
Notice
Scaling of nodes should be avoided whenever possible as it requires addidional calculations and may lead to error accumulation.
set value - Node scale in the local space.

Vec3 Position#

The node position.
set
Sets the node position.
set value - Node position in the local space

WorldSector WorldSector#

A sector, in which the node is located.

vec3 AngularVelocity#

The angular velocity of the node's physical body in the local space.

vec3 LinearVelocity#

The linear velocity of the node's physical body in the local space.

BodyRigid ObjectBodyRigid#

A rigid body assigned to the node if it is an object node.

Body ObjectBody#

A physical body assigned to the node if it is an object node.

WorldBoundSphere WorldBoundSphere#

The bounding sphere of the node in world's coordinate system.

WorldBoundBox WorldBoundBox#

The bounding box of the node in world's coordinate system.

BoundSphere BoundSphere#

The bounding sphere of the node.
Notice
The coordinates of the bounding sphere are in the node's local coordinate system. To get the bounding sphere in world coordinates, use the getWorldBoundSphere() method.

BoundBox BoundBox#

The bounding box of the node.
Notice
The coordinates of the bounding box are in the node's local coordinate system. To get the bounding box in world coordinates, use the getWorldBoundBox() method.

Mat4 OldWorldTransform#

Old (previous frame) transformation matrix for the node in the world coordinates.
set
Sets old (previous frame) transformation matrix for the node in the world coordinates.
set value - Old (previous frame) transformation matrix to be set.

Mat4 WorldTransform#

The transformation matrix of the node in the world coordinates.
set
Sets the transformation matrix for the node in the world coordinates.
set value - Transformation matrix.

Mat4 Transform#

The transformation matrix of the node in its parent coordinates.
set
Sets the transformation matrix for the node in its parent coordinates.
set value - New transformation matrix.

int NumProperties#

The total number of properties associated with the node.

Node Possessor#

A possessor of the node. the following nodes can be possessors:
  • NodeReference
  • WorldCluster
  • WorldClutter
  • WorldLayer
This function can only be applied to a root node inside a node reference.

int NumChildren#

The number of children of the node.

Node RootNode#

The root node for the node. this method searches for the root node among all node's parents and posessors up the hierarchy. If a node does not have a parent or posessor the node itself will be returned.

Node Parent#

The parent of the node.
set
Sets the new parent for the node. Transformations of the current node will be done in the coordinates of the parent.
set value - New parent node.

int NumAncestors#

The number of ancestors of the node.

string Data#

User data associated with the node.
  • If the node was loaded from the *.node file, data from the data tag of this file is returned.
  • If the node is loaded from the *.world file, data from the Node data tag of the *.world file is returned.
  • If the node is loaded from the *.world file as a NodeReference, data from the NodeReference data tag of the *.world file is returned.
set
Sets user data associated with the node.
  • If the node was loaded from the *.node file, data is saved directly into the data tag of this file.
  • If the node is loaded from the *.world file, data is saved into the Node data tag of the *.world file.
  • If the node is loaded from the *.world file as a NodeReference, data will be saved to the NodeReference data tag of the *.world file.
set value - New user data. Data can contain an XML formatted string.

string Name#

The name of the node.
set
Sets a name for the node.
set value - New name of the node.

bool IsFolded#

A value indicating if node children are displayed or minimized in the node tree hierarchy.
set
Shows or minimizes node children in the node tree hierarchy.
set value - Positive number to minimize node children; 0 to expand node hierarchy.

bool IsLatest#

Checks if a node is forced to be updated the last of all, after states of all other nodes were updated. For example, a post update flag is useful to draw nodes strictly in front of the camera (after a Player has updated its transformations). By default, this flag is set to 0.
set
Sets a flag that forces a node to be updated the last of all, after states of all other nodes were updated. For example, a post update flag is useful to draw nodes strictly in front of the camera (after a Player has updated its transformations). By default, this flag is set to 0.
set value - Positive value to update a node last of all; otherwise, 0.

bool IsQuery#

A value indicating if occlusion query is used for the node. the default is 0 (not used).
set
Updates a value indicating if occlusion query is used for the node.
set value - Positive number to use occlusion query, 0 not to use.

bool IsClutterInteractionEnabled#

A value indicating if interaction with World Clutters and Mesh Clutters is enabled for the node.
Notice
It is recommended to disable this option for better performance, when cutting node out of clutters is not necessary. Especially when the world contains a significant number of such nodes.
set
Sets a value indicating if interaction with World Clutters and Mesh Clutters is enabled for the node.
Notice
It is recommended to disable this option for better performance, when cutting node out of clutters is not necessary. Especially when the world contains a significant number of such nodes.
set value - 1 to enable interaction with World Clutters and Mesh Clutters, 0 to disable it.

bool IsGrassInteractionEnabled#

A value indicating if interaction with Grass nodes is enabled for the node.
Notice
It is recommended to disable this option for better performance, when cutting node out of grass is not necessary. Especially when the world contains a significant number of such nodes.
set
Sets a value indicating if interaction with Grass nodes is enabled for the node.
Notice
It is recommended to disable this option for better performance, when cutting node out of grass is not necessary. Especially when the world contains a significant number of such nodes.
set value - 1 to enable interaction with Grass nodes, 0 to disable it.

bool IsTriggerInteractionEnabled#

A value indicating if interaction with WorldTrigger nodes is enabled for the node.
Notice
It is recommended to disable this option for better performance, when node interaction with World Triggers is not necessary. Especially when the world contains a significant number of such nodes.
set
Sets a value indicating if interaction with WorldTrigger nodes is enabled for the node.
Notice
It is recommended to disable this option for better performance, when node interaction with World Triggers is not necessary. Especially when the world contains a significant number of such nodes.
set value - 1 to enable interaction with World Triggers, 0 to disable it.

bool IsPortalCullingEnabled#

A value indicating if sectors and portals are used for node visibility determination.
set
Updates a value indicating if sectors and portals are used for node visibility determination.
set value - 1 to consider sectors and portals; otherwise, 0.

bool IsImmovable#

A value indicating if the node is an immovable (clutter) object, which means it is moved to a separate spatial tree for immovable (static) objects optimizing node management.
set
Sets a value indicating if the node represents an immovable (clutter) object, which means it is moved to a separate spatial tree for immovable (static) objects optimizing node management.
set value - Positive number to mark the node as an immovable object; otherwise, 0.

bool IsCollider#

A value indicating if collision detection is enabled for the node.
set
Updates a value indicating if collision detection is enabled for the node (i.e. the node is a collider object). If it is disabled, the node is removed from the physical scene and does not participate in physical interactions.
Notice
Collision detection tests can be performed using getCollision() methods of the World class.
set value - Positive number to enable collision detection, 0 to disable.

bool IsHandled#

A value indicating if the node handle is displayed. this option is valid only for invisible nodes, such as light and sound sources, particle systems and world-managing nodes (WorldSector, WorldPortal, WorldOccluder, triggers, expressions, etc.)
set
Disables or shows the node handle. This option is valid only for invisible nodes, such as light and sound sources, particle systems and world-managing nodes (WorldSector, WorldPortal, WorldOccluder, triggers, expressions, etc.)
set value - Positive value to show the handle, 0 to hide it.

bool IsEnabled#

A value indicating if the node and its parent nodes are enabled.
set
Enables or disables the node.
set value - 1 to enable the node, 0 to disable it.

bool IsShadow#

A value indicating if the node was a shadow caster in the previous frame and, therefore, is updated.

bool IsVisible#

A value indicating if the node was shown in the viewport in the previous frame and, therefore, is updated.

bool IsExtern#

A value indicating if the node is an extern node (its type is one of the following: NODE_EXTERN, OBJECT_EXTERN, WORLD_EXTERN).

bool IsField#

A value indicating if the node is a field node (its type is one of the FIELD_*).

bool IsSound#

A value indicating if the node is a sound node (its type is SOUND_*).

bool IsObstacle#

A value indicating if the node is an obstacle node (its type is OBSTACLE_*).

bool IsNavigation#

A value indicating if a given node is a navigation node.

bool IsPhysical#

A value indicating if the node is a physical node (its type is PHYSICAL_*).

bool IsPlayer#

A value indicating if the node is a player node (its type is PLAYER_*).

bool IsObject#

A value indicating if the node is an object node (its type is OBJECT_*).

bool IsDecal#

A value indicating if the node is a decal node (its type is DECAL_*).

bool IsLight#

A value indicating if the node is a light source (its type is LIGHT_*).

bool IsGeodetic#

A value indicating if the node is a geodetic-related node.

bool IsWorld#

A value indicating if the node is a world node (its type is WORLD_*).

string TypeName#

A name of the node type.

Node.TYPE Type#

A type of the node.

int ID#

The id of the node.
Notice
See also engine.world.getNode() function.
set
Sets a unique ID for the node.
set value - Node ID.

Members


Node GetAncestor ( int num ) #

Returns a node ancestor by its number.

Arguments

  • int num - Ancestor ID.

Return value

Ancestor node.

Node GetChild ( int num ) #

Returns a node child by its number.

Arguments

  • int num - Child ID.

Return value

Child node.

bool IsChild ( Node n ) #

Checks if a given node is a child of the node.

Arguments

  • Node n - Node to check.

Return value

1 if the given node is a child; otherwise, 0.

void SetChildIndex ( Node n, int index ) #

Sets the index for a given child node of the node.

Arguments

  • Node n - Child node.
  • int index - Node index.

int GetChildIndex ( Node n ) #

Returns the index of a given child node of the node.

Arguments

  • Node n - Child node.

Return value

Node index.

void UpdateEnabled ( ) #

Updates node's internal state according to the current "enabled" state.

int IsEnabledSelf ( ) #

Returns a value indicating if the node is enabled.

Return value

1 if the node is enabled; otherwise, 0.

void DeleteHierarchy ( Node node ) #

Deletes the whole hierarchy of the given node.

Arguments

  • Node node - Node, the hierarchy of which is to be deleted.

void GetHierarchy ( Node[] hierarchy ) #

Retrieves the whole hierarchy of the node and puts it to the hierarchy buffer.

Arguments

  • Node[] hierarchy - Hierarchy buffer.

Mat4 GetIWorldTransform ( ) #

Returns the inverse transformation matrix of the node for transformations in the world coordinates.

Return value

Inverse transformation matrix.

Node GetNode ( ) #

Returns a node pointer.

Return value

Node pointer.

Node GetNode ( int id ) #

Returns a node pointer.

Arguments

  • int id - Node identifier.

Return value

Node pointer.

int IsNode ( Node node ) #

Check the node pointer.

Arguments

  • Node node - Node pointer.

Return value

Returns 1 if the node is valid; otherwise, 0.

int IsNode ( int id ) #

Check the node pointer.

Arguments

  • int id - Node pointer.

Return value

Returns 1 if the node is valid; otherwise, 0.

int IsOwner ( ) #

Returns the owner flag. If the pointer is the owner, on its deletion the node also will be deleted. Use grab() and release() functions to change ownership

Return value

Owner flag.

int AddProperty ( string name ) #

Inherits a new property from the one with the given name and adds it to the list of properties associated with the node. The inherited property will be internal, such properties are saved in a *.world or *.node file.

Arguments

  • string name - Name of the property to be added.

Return value

Index of the new node property if it was added successfully; otherwise, -1.

int AddProperty ( UGUID guid ) #

Inherits a new property from the one with the given GUID and adds it to the list of properties associated with the node. The inherited property will be internal, such properties are saved in a *.world or *.node file.

Arguments

  • UGUID guid - GUID of the property to be added.

Return value

Index of the new node property if it was added successfully; otherwise, -1.

int AddProperty ( Property property ) #

Inherits a new property from the specified one and adds it to the list of properties associated with the node. The inherited property will be internal, such properties are saved in a *.world or *.node file.

Arguments

  • Property property - Property to be added.

Return value

Index of the new node property if it was added successfully; otherwise, -1.

int InsertProperty ( int num, string name ) #

Inserts the property with the specified name at the specified position.

Arguments

  • int num - Position at which a new property is to be inserted, in the range from 0 to the total number of node properties.
  • string name - Name of the property to be inserted.

Return value

1 if the property with the specified name was successfully inserted at the specified position; otherwise, 0.

int InsertProperty ( int num, UGUID guid ) #

Inserts the property with the specified GUID at the specified position.

Arguments

Return value

1 if the property with the specified GUID was successfully inserted at the specified position; otherwise, 0.

int InsertProperty ( int num, Property property ) #

Inserts the specified property at the specified position.

Arguments

  • int num - Position at which a new property is to be inserted, in the range from 0 to the total number of node properties.
  • Property property - Property to be added.

Return value

1 if the specified property was successfully inserted at the specified position; otherwise, 0.

int SetProperty ( string name ) #

Updates the first node property (the one with a 0 index) in the list of properties associated with the node. A new internal property inherited from the one with the specified name will be set. Such internal properties are saved in a *.world or *.node file.

Arguments

  • string name - Name of the property to be set.

Return value

1 if the node property is updated successfully; otherwise, 0.

int SetProperty ( UGUID guid ) #

Updates the first node property (the one with a 0 index) in the list of properties associated with the node. A new internal property inherited from the one with the specified GUID will be set. Such internal properties are saved in a *.world or *.node file.

Arguments

  • UGUID guid - GUID of the property to be set.

Return value

1 if the node property is updated successfully; otherwise, 0.

int SetProperty ( Property property ) #

Updates the first node property (the one with a 0 index) in the list of properties associated with the node. A new internal property inherited from the one specified will be set. Such internal properties are saved in a *.world or *.node file.

Arguments

  • Property property - Property to be set.

Return value

1 if the node property is updated successfully; otherwise, 0.

int SetProperty ( int num, string name ) #

Updates the node property with the specified number. A new internal property inherited from the one with the specified name will be set. Such internal properties are saved in a *.world or *.node file.

Arguments

Return value

1 if the specified node property is updated successfully; otherwise, 0.

int SetProperty ( int num, UGUID guid ) #

Updates the node property with the specified number. A new internal property inherited from the one with the specified GUID will be set. Such internal properties are saved in a *.world or *.node file.

Arguments

Return value

1 if the specified property is updated successfully; otherwise, 0.

int SetProperty ( int num, Property property ) #

Updates the node property with the specified number. A new internal property inherited from the specified one will be set. Such internal properties are saved in a *.world or *.node file.

Arguments

Return value

1 if the specified node property is updated successfully; otherwise, 0.

void SetPropertyEnabled ( int num, bool enable ) #

Enables or disables the node property with the specified number.

Arguments

  • int num - Node property number in the range from 0 to the total number of node properties.
  • bool enable - 1 to enable the specified node property, 0 to disable it.

bool IsPropertyEnabled ( int num ) #

Returns a value indicating if the node property with the specified number is enabled.

Arguments

Return value

1 if the specified property is enabled; otherwise, 0.

void SwapProperty ( int from_num, int to_num ) #

Swaps two properties with specified numbers in the list of properties associated with the node.
Notice
The order of properties in the list determines the execution sequence of logic of corresponding components (if any).

Arguments

void RemoveProperty ( int num ) #

Removes the node property with the specified number.

Arguments

void RemoveProperty ( string name ) #

Removes the node property that has the specified name.
Notice
If several properties with the same name are associated with the node, only the first one will be removed.

Arguments

  • string name - Name of the node property to be removed.

void RemoveProperty ( UGUID guid ) #

Removes the node property that has the GUID or parent GUID equal to the specified one.
Notice
If several such properties are associated with the node, only the first one will be removed.

Arguments

  • UGUID guid - GUID of the property to be removed (or GUID of its parent).

void RemoveProperty ( Property property ) #

Removes the specified node property or a node property inherited from it.
Notice
If several such properties are associated with the node, only the first one will be removed.

Arguments

  • Property property - Node property to be removed.

void ClearProperties ( ) #

Clears the list of properties associated with the node.

Property GetProperty ( int num ) #

Returns a node property with the specified number if it exists.

Arguments

Return value

Node property smart pointer, if exists; otherwise, NULL.

string GetPropertyName ( int num ) #

Returns the name of a node property with the specified number.

Arguments

Return value

Property name, if exists; otherwise, NULL.

int FindProperty ( string name ) #

Searches for a property with the specified name among the ones assigned to the node.

Arguments

  • string name - GUID of a node property to be found.

Return value

Node property number in the range from 0 to the total number of node properties if such a property exists; otherwise -1.

int FindProperty ( UGUID guid ) #

Searches for a property with the specified GUID among the ones assigned to the node.

Arguments

  • UGUID guid - GUID of a node property to be found.

Return value

Node property number in the range from 0 to the total number of node properties if such a property exists; otherwise -1.

int FindProperty ( Property property ) #

Searches for a specified property among the ones assigned to the node.

Arguments

  • Property property - Node property to be found.

Return value

Node property number in the range from 0 to the total number of node properties if such a property exists; otherwise -1.

void SetRotation ( quat rot, bool identity = 0 ) #

Sets the node rotation.

Arguments

  • quat rot - Quaternion representing node rotation in the local space.
  • bool identity - Flag indicating if node's scale is to be ignored or taken into account:
    • 0 - node's scale is taken into account. In this case additional calculations are performed to extract current node's scale and apply it when buiding the final transformation matrix. These additional operations reduce performance and may lead to error accumulation.
    • 1 - node's scale is ignored (assumed to be equal to 1 along all axes). Thus, the number of calculations performed for each rotation is reduced and error accumulation is minimal.
    Notice
    • It is recommended to set this flag to 1 for all non-scaled nodes to improve performance and accuracy.
    • Scaling of nodes should be avoided whenever possible, as it requires addidional calculations and may lead to error accumulation.

void SetWorldRotation ( quat rot, bool identity = 0 ) #

Sets the node rotation in the world space.

Arguments

  • quat rot - Node rotation in the world space.
  • bool identity - Flag indicating if node's scale is to be ignored or taken into account:
    • 0 - node's scale is taken into account. In this case additional calculations are performed to extract current node's scale and apply it when buiding the final transformation matrix. These additional operations reduce performance and may lead to error accumulation.
    • 1 - node's scale is ignored (assumed to be equal to 1 along all axes). Thus, the number of calculations performed for each rotation is reduced and error accumulation is minimal.
    Notice
    • It is recommended to set this flag to 1 for all non-scaled nodes to improve performance and accuracy.
    • Scaling of nodes should be avoided whenever possible, as it requires addidional calculations and may lead to error accumulation.

Node.TYPE GetTypeId ( string type ) #

Returns the ID of a node type with a given name.

Arguments

  • string type - Node type name.

Return value

Node type ID, if such type exists; otherwise, -1.

string GetTypeName ( Node.TYPE type ) #

Returns the name of a node type with a given ID.

Arguments

  • Node.TYPE type - Node type ID.

Return value

Node type name.

void SetVariable ( string name, Variable variable ) #

Sets the value of a variable with a given name. If such variable does not exist it will be added with a specified value.
Source code (C#)
NodeDummy container;
if(container.HasVariable("key1")) {
	container.SetVariable("key1",42);
}
int value = container.GetVariable("key1");
container.RemoveVariable("key1");

Arguments

  • string name - Variable name.
  • Variable variable - Variable value.

void SetVariable ( Variable variable ) #

Sets the value of the single unnamed variable parameter of the node. If this variable does not exist it will be created with a specified value.

Arguments

  • Variable variable - Variable value.

Variable GetVariable ( string name ) #

Returns the variable with a given name.
Source code (C#)
NodeDummy container;
if(container.HasVariable("key1")) {
	container.SetVariable("key1",42);
}
int value = container.GetVariable("key1");
container.RemoveVariable("key1");

Arguments

  • string name - Variable name.

Return value

Variable if it exists; otherwise, variable with 0 value.

Variable GetVariable ( ) #

Returns the single unnamed variable parameter of the node.

Return value

Variable if it exists; otherwise, variable with 0 value.

void SetWorldParent ( Node n ) #

Sets the new parent of the node. Transformations of the current node will be done in the world coordinates.

Arguments

  • Node n - New parent node.

vec3 GetWorldVelocity ( Vec3 point ) #

Returns linear velocity of a point of the node's physical body in the world space.

Arguments

  • Vec3 point - Target point.

Return value

Linear velocity in the world space.

void AddChild ( Node n ) #

Adds a child to the node. Transformations of the new child will be done in the coordinates of the parent.

Arguments

  • Node n - New child node.

void AddWorldChild ( Node n ) #

Adds a child to the node. Transformations of the new child will be done in the world coordinates.

Arguments

  • Node n - New child node.

Node Clone ( ) #

Clones the node.
Notice
If the node is owned by the Editor, its clone shall also be owned by it, and vice versa.

Return value

Cloned node.

int FindAncestor ( int type ) #

Returns the ID of node's ancestor of a given type.

Arguments

  • int type - Ancestor type identifier. One of the NODE_* pre-defined variables.

Return value

Ancestor ID if it exists; otherwise -1.

int FindAncestor ( string name ) #

Returns the ID of node's ancestor with a given name.

Arguments

  • string name - Ancestor name.

Return value

Ancestor ID if it exists; otherwise -1.

int FindChild ( string name ) #

Searches for a child node with a given name among the children of the node.

Arguments

  • string name - Name of the child node.

Return value

Child node number, if it is found; otherwise, -1.

Node FindNode ( string name, int recursive = 0 ) #

Searches for a node with a given name among the children of the node.

Arguments

  • string name - Name of the child node.
  • int recursive - 1 if the search is recursive (i.e. performed for children of child nodes); otherwise, 0.

Return value

Child node, if it is found; otherwise, NULL.

void Grab ( ) #

Grabs the node (sets the owner flag to 1). The node should not be handled by the engine after this function is called.

bool LoadWorld ( Xml xml ) #

Loads a node state from the Xml.

Arguments

  • Xml xml - Xml smart pointer.

Return value

1 if the node state is loaded successfully; otherwise, 0.

void Release ( ) #

Releases the node (sets the owner flag to 0). The node should be handled by the engine after this function is called.

void RemoveChild ( Node n ) #

Removes a child node (added by the addChild() method) from the list of children.

Arguments

  • Node n - Child node to remove.

void RemoveWorldChild ( Node n ) #

Removes a child node (added by the addWorldChild() method) from the list of children.

Arguments

  • Node n - Child node to remove.

void RenderVisualizer ( ) #

Renders a bounding box / sphere of the object.
Notice
You should enable the engine visualizer by the show_visualizer 1 console command.

bool RestoreState ( Stream stream ) #

Restores a node state from the stream.
Warning
This function is deprecated and will be removed in the next release.

Arguments

  • Stream stream - Stream with saved node state data.

Return value

1 if node state is successfully restored; otherwise, 0.

bool SaveState ( Stream stream ) #

Saves a node state into the stream.
Warning
This function is deprecated and will be removed in the next release.

Arguments

  • Stream stream - Stream to save node state data.

Return value

1 if node state is successfully saved; otherwise, 0.

bool SaveWorld ( Xml xml ) #

Saves a node state into the Xml.

Arguments

  • Xml xml - Xml smart pointer.

Return value

1 if the node state is saved successfully; otherwise, 0.

void Swap ( Node n ) #

Swaps two nodes.

Arguments

  • Node n - Node to swap.

vec3 ToLocal ( Vec3 p ) #

Converts a given vector in the world space to the node's local space.

Arguments

  • Vec3 p - Vector in the world space.

Return value

Vector in the local space.

Vec3 ToWorld ( vec3 p ) #

Converts a given vector in the local space to the world space.

Arguments

  • vec3 p - Vector in the local space.

Return value

Vector in the world space.

void Translate ( Vec3 t ) #

Translates the node relative to its local coordinate system: the parent node transformation isn't taken into account.

Arguments

  • Vec3 t - Translation vector.

void Translate ( double x, double y, double z ) #

Translates the node relative to its local coordinate system: the parent node transformation isn't taken into account.

Arguments

  • double x - Node translation along the X axis, in units.
  • double y - Node translation along the Y axis, in units.
  • double z - Node translation along the Z axis, in units.

void WorldTranslate ( Vec3 t ) #

Translates the node in the world space using the specified vector.

Arguments

  • Vec3 t - Translation vector.

void WorldTranslate ( double x, double y, double z ) #

Translates the node in the world space using the values specified for the corresponding axes.

Arguments

  • double x - Node translation along the X axis, in units.
  • double y - Node translation along the Y axis, in units.
  • double z - Node translation along the Z axis, in units.

void WorldLookAt ( Vec3 target, vec3 up ) #

Reorients the node to "look" at the target point and sets the given up vector:
  • If the node is a Player-related one, it will "look" at the target point along the negative Z axis. The Y axis will be oriented along the specified up vector.
  • Other nodes will "look" at the target point along the Y axis. The Z axis will be oriented along the specified up vector.

Arguments

  • Vec3 target - Coordinates of the target point in the world space.
  • vec3 up - Up vector of the node in the world space. By default, the up vector is oriented along the Z axis.

void WorldLookAt ( Vec3 target ) #

Reorients the node to "look" at the target point. The up vector is oriented along the Z axis.
  • If the node is a Player-related one, it will "look" at the target point along the negative Z axis. The Y axis will be oriented along the world Z axis.
  • Other nodes will "look" at the target point along the Y axis.

Arguments

  • Vec3 target - Coordinates of the target point in the world space.

void Rotate ( quat r ) #

Rotates the node relative to its local coordinate system: the parent node transformation isn't taken into account. Rotation is determined by the specified quaternion.

Arguments

  • quat r - Rotation quaternion.

void Rotate ( vec3 angles ) #

Rotates the node in the local space. Rotation is determined by Euler angles passed as a vec3 vector.

Arguments

  • vec3 angles

void Rotate ( float angle_x, float angle_y, float angle_z ) #

Rotates the node in the world space according to specified Euler angles.

Arguments

  • float angle_x - Pitch angle, in degrees.
  • float angle_y - Roll angle, in degrees.
  • float angle_z - Yaw angle, in degrees.

void WorldRotate ( quat r ) #

Rotates the node in the world space. Rotation is determined by the specified quaternion.

Arguments

  • quat r - Rotation quaternion.

void WorldRotate ( vec3 angles ) #

Rotates the node in the world space. Rotation is determined by Euler angles passed as a vec3 vector.

Arguments

  • vec3 angles - Vector containing Euler angles (Pitch, Yaw, Roll).

void WorldRotate ( float angle_x, float angle_y, float angle_z ) #

Rotates the node in the world space according to specified Euler angles.

Arguments

  • float angle_x - Pitch angle, in degrees.
  • float angle_y - Roll angle, in degrees.
  • float angle_z - Yaw angle, in degrees.

IntPtr addCallback ( int callback, Callback0Delegate func ) #

Adds a callback of the specified type. Callback functions can be used to determine actions to be performed when adding or removing node and surface properties as well as when swapping node properties. The signature of the callback function must be as follows:
Source code (C#)
void callback_function_name(Node node, Property property);
Here is an example demonstrating how to track adding a node property via callbacks:
Source code (C#)
using Unigine;

namespace UnigineApp
{
	class AppWorldLogic : WorldLogic
	{	
		// implement the enabled callback
        void node_property_added(Node n, Property property)
        {
			Log.message("Property \"{0}\" was added to the node named \"{1}\".\n", property.getName(), n.getName());
			// ...
        }

		Node node;
		
        public override int init()
        {
			// somewhere in the code

			Properties properties = Properties.get();

			// inheriting a new property named "my_prop" from the base property "node_base"
			properties.findManualProperty("node_base").inherit("my_prop");

			// setting our callback function on adding a node property
			Node.addCallback(Node.CALLBACK_PROPERTY_NODE_ADD, node_property_added);

			// adding the property named "my_prop" to the node
			node.addProperty("my_prop");

            return 1;
        }
	}
}

Arguments

  • int callback - Callback type. One of the CALLBACK_* variables.
  • Callback0Delegate func - Callback function with the following signature: void Callback0Delegate(Node node, Property property)

Return value

ID of the last added callback of the specified type, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

IntPtr addCallback ( int callback, Callback1Delegate func ) #

Adds a callback of the specified type. Callback functions can be used to determine actions to be performed when adding or removing node and surface properties as well as when swapping node properties. The signature of the callback function must be as follows:
Source code (C#)
void callback_function_name(Node node, Property property, int arg3);

Arguments

  • int callback - Callback type. One of the CALLBACK_* variables.
  • Callback1Delegate func - Callback function with the following signature: void Callback1Delegate(Node node, Property property, int arg3)

Return value

ID of the last added callback of the specified type, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

IntPtr addCallback ( int callback, Callback2Delegate func ) #

Adds a callback of the specified type. Callback functions can be used to determine actions to be performed when adding or removing node and surface properties as well as when swapping node properties. The signature of the callback function must be as follows:
Source code (C#)
void callback_function_name(Node node, int arg2, int arg3);

Arguments

  • int callback - Callback type. One of the CALLBACK_* variables.
  • Callback2Delegate func - Callback function with the following signature: void Callback2Delegate(Node node, int arg2, int arg3)

Return value

ID of the last added callback of the specified type, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool removeCallback ( int callback, IntPtr id ) #

Removes the specified callback from the list of callbacks of the specified type. Callback functions can be used to determine actions to be performed when adding or removing node and surface properties as well as when swapping node properties.

Arguments

  • int callback - Callback type. One of the CALLBACK_* variables.
  • IntPtr id - Callback ID obtained when adding it.

Return value

True if the callback of the specified type with the given ID was removed successfully; otherwise false.

void clearCallbacks ( int callback ) #

Clears all added callbacks of the specified type. Callback functions can be used to determine actions to be performed when adding or removing node and surface properties as well as when swapping node properties.

Arguments

  • int callback - Callback type. One of the CALLBACK_* variables.

void SetDirection ( vec3 dir, vec3 up, MathLib.AXIS axis = AXIS_NZ ) #

Updates the direction vector of the node and reorients this node: the specified axis of the node becomes oriented along the specified vector in local coordinates. For example, after running the code below, you will get the X axis of the node pointed along the Y axis in local coordinates.
Source code (C#)
// get the node
Node node = Editor.get().getNodeByName("material_ball");
// set the X axis to be pointed along the Y axis in local coordinates
node.setDirection(new vec3(0.0f,1.0f,0.0f),new vec3(0.0f,0.0f,1.0f),MathLib.AXIS_X);

Arguments

  • vec3 dir - New direction vector in local coordinates. The direction vector always has unit length.
  • vec3 up - New up vector in local coordinates. If you skip this argument, the Z axis (in local coordinates) will be used. Note that the specified up vector is a hint vector only: the node's up vector points in the direction hinted by the specified up vector. The node's up vector matches the specified up vector (up) only if it is perpendicular to the specified direction vector (dir).
  • MathLib.AXIS axis - Axis along which the direction vector should be pointed. The default is the negative Z axis.

vec3 GetDirection ( MathLib.AXIS axis = AXIS_NZ ) #

Returns the normalized direction vector pointing along the given node axis in local coordinates (i.e. relative to the node's parent). By default, the direction vector pointing along the negative Z axis of the node (in local coordinates) is returned. The direction vector always has a unit length.
Source code (C#)
node.getDirection(node.isPlayer() ? MathLib.AXIS_NZ : MathLib.AXIS_Y); // forward direction vector
node.getDirection(node.isPlayer() ? MathLib.AXIS_Z : MathLib.AXIS_NY); // backward direction vector
node.getDirection(node.isPlayer() ? MathLib.AXIS_Y : MathLib.AXIS_Z); // upward direction vector
node.getDirection(node.isPlayer() ? MathLib.AXIS_NY : MathLib.AXIS_NZ); // down direction vector
node.getDirection(MathLib.AXIS_X); // right direction vector
node.getDirection(MathLib.AXIS_NX); // left direction vector

Arguments

  • MathLib.AXIS axis - Axis along which the direction vector points. The default is the negative Z axis.

Return value

Direction vector in local coordinates.

void SetWorldDirection ( vec3 dir, vec3 up, MathLib.AXIS axis = AXIS_NZ ) #

Updates the direction vector of the node and reorients this node: the specified axis of the node becomes oriented along the specified vector in world coordinates. For example, after running the code below, you will get the X axis of the node pointed along the Y axis in world coordinates:
Source code (C#)
// get the node
Node node = Editor.get().getNodeByName("material_ball");
// set the X axis to be pointed along the Y axis in world coordinates
node.setWorldDirection(new vec3(0.0f,1.0f,0.0f),new vec3(0.0f,0.0f,1.0f),MathLib.AXIS_X);

Arguments

  • vec3 dir - New direction vector in world coordinates. The direction vector always has unit length.
  • vec3 up - New up vector in world coordinates. If you skip this argument, the Z axis (in local coordinates) will be used. Note that the specified up vector is a hint vector only: the node's up vector points in the direction hinted by the specified up vector. The node's up vector matches the specified up vector (up) only if it is perpendicular to the specified direction vector (dir).
  • MathLib.AXIS axis - Axis along which the direction vector should be pointed. The default is the negative Z axis.

vec3 GetWorldDirection ( MathLib.AXIS axis = AXIS_NZ ) #

Returns the normalized direction vector pointing along the given node axis in world coordinates. By default, the direction vector pointing along the negative Z axis of the node is returned. The direction vector always has a unit length.
Source code (C#)
node.getWorldDirection(node.isPlayer() ? MathLib.AXIS_NZ : MathLib.AXIS_Y); // forward direction vector
node.getWorldDirection(node.isPlayer() ? MathLib.AXIS_Z : MathLib.AXIS_NY); // backward direction vector
node.getWorldDirection(node.isPlayer() ? MathLib.AXIS_Y : MathLib.AXIS_Z); // upward direction vector
node.getWorldDirection(node.isPlayer() ? MathLib.AXIS_NY : MathLib.AXIS_NZ); // down direction vector
node.getWorldDirection(MathLib.AXIS_X); // right direction vector
node.getWorldDirection(MathLib.AXIS_NX); // left direction vector

Arguments

  • MathLib.AXIS axis - Axis along which the direction vector points. The default is the negative Z axis.

Return value

Direction vector in world coordinates.

Node GetCloneNode ( Node original_node ) #

Returns a node cloned from the specified original node.
Notice
This method is intended for use only inside the node clone callback.

Arguments

  • Node original_node - Original node that was cloned.

Return value

Clone of the specified original node if it exists; otherwise the original node itself.

Property GetCloneProperty ( Property original_property ) #

Returns a node property cloned from the specified original property.
Notice
This method is intended for use only inside the node clone callback.

Arguments

  • Property original_property - Original node property that was cloned.

Return value

Clone of the specified original node property if it exists; otherwise the original node property itself.
Last update: 2019-11-28
Build: ()