Programming
Fundamentials
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
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes

Node Class

Interface for node handling. See also UnigineScript analog.

To use this class, include the UnigineNode.h file.

Node Class

Members


void setTransform (const Math::Mat4 & transform)

Sets the transformation matrix for the node in its parent coordinates.

Arguments

  • const Math::Mat4 & transform - New transformation matrix.

void setLatest (int latest)

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.

Arguments

  • int latest - Positive value to update a node last of all; otherwise, 0.

Ptr<Property> getProperty ()

Returns the node property smart pointer.

Return value

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

int isNode (const Ptr<Node> & node)

Check the node pointer.

Arguments

  • const Ptr<Node> & node - Node pointer.

Return value

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

BoundSphere getBoundSphere ()

Returns the bounding sphere of the node.

Return value

Bounding sphere of the node.

int isObstacle ()

Returns a value indicating if a given node is an obstacle node.

Return value

Returns 1 if the given node is an obstacle node; otherwise, 0.

int getType ()

Returns a type of the node.

Return value

Node type identifier.

int setID (int id)

Sets a unique identifier to the node.

Arguments

  • int id - Node identifier.

Return value

Returns 1 if the node ID is set successfully; otherwise, 0.

int saveState (const Ptr<Stream> & stream)

Saves a node state into the stream.

Arguments

  • const Ptr<Stream> & stream - Stream smart pointer.

Return value

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

void setNodeWorldPosition (const Math::Vec3 & pos)

Updates the node position.

Arguments

  • const Math::Vec3 & pos - New position in the world space.

UNIGINE_BOUND_SPHERE getWorldBoundSphere ()

Returns the world bounding sphere of the node.

Return value

World bounding sphere.

void setParent (const Ptr<Node> & parent)

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

Arguments

  • const Ptr<Node> & parent - New parent node.

int isVisible ()

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

Return value

1 if the node was visible; otherwise, 0.

void setCollider (int collider)

Updates a value indicating if collision test enabled for the node.

Arguments

  • int collider - Positive number to enable collision test, 0 to disable.

void setNodeDirection (const Math::vec3 & dir, const Math::vec3 & up)

Updates the direction vector of the node. By default, a direction vector points along -Z axis. This function changes its direction and reorients the node.

Arguments

  • const Math::vec3 & dir - New direction vector in the local space. The direction vector always has unit length.
  • const Math::vec3 & up - New up vector in the local space.

int getID ()

Returns a unique identifier of the node.

Return value

Unique node identifier.

void setSpatial (int spatial)

Updates a value indicating if sectors and portals are used for node visibility determination.

Arguments

  • int spatial - Positive value to consider sectors and portals; otherwise, 0.

void setFolded (int folded)

Shows or minimizes node children in the node tree hierarchy.

Arguments

  • int folded - Positive number to minimize node children; 0 to expand node hierarchy.

Math::Vec3 getNodeWorldPosition ()

Returns the node position.

Return value

The node position in the world space.

Math::quat getNodeWorldRotation ()

Returns the node rotation.

Return value

The node rotation in the local space.

void setEnabled (int enabled)

Enables or disables the node.

Arguments

  • int enabled - 1 to enable the node, 0 to disable it.

void setNodePosition (const Math::Vec3 & pos)

Updates the node position.

Arguments

  • const Math::Vec3 & pos - New position in the local space.

Math::vec3 getAngularVelocity ()

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

Return value

Angular velocity in the local space.

int loadWorld (const Ptr<Xml> & xml)

Loads a node state from the Xml.

Arguments

  • const Ptr<Xml> & xml - Xml smart pointer.

Return value

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

int isClutter ()

Returns a value indicating if the node is a clutter object.

Return value

Returns 1 if the node is a clutter object; otherwise, 0.

void swap (const Ptr<Node> & n)

Swaps two nodes.

Arguments

  • const Ptr<Node> & n - Node to swap.

int isGeodetic ()

Return value

int isWorld ()

Returns a value indicating if a given node is a world node.

Return value

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

void addWorldChild (const Ptr<Node> & n)

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

Arguments

  • const Ptr<Node> & n - New child node.

Ptr<Node> getChild (int num)

Returns the node child by its number.

Arguments

  • int num - Number of the child.

Return value

Child node.

int isNavigation ()

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

Return value

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

void setNodeWorldScale (const Math::vec3 & s)

Arguments

  • const Math::vec3 & s

Math::Mat4 getIWorldTransform ()

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

Return value

Inverse transformation matrix.

Math::quat getNodeRotation ()

Returns the node rotation.

Return value

The node rotation in the local space.

int isShadow ()

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

Return value

1 if the node was a shadow caster; otherwise, 0.

void setData (const char * data)

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.

Arguments

  • const char * data - New user string data. Data can be an xml formatted string.

Ptr<Node> getNode ()

Returns a node pointer.

Return value

Node pointer.

void removeChild (const Ptr<Node> & n)

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

Arguments

  • const Ptr<Node> & n - Child node to remove.

Math::vec3 getLinearVelocity ()

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

Return value

Linear velocity in the local space.

int isNode (int id)

Check the node pointer.

Arguments

  • int id - Node pointer.

Return value

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

Math::vec3 getWorldVelocity (const Math::Vec3 & point)

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

Arguments

  • const Math::Vec3 & point - A target point.

Return value

Linear velocity in the world space.

const char * getTypeName ()

Returns a name of the node type.

Return value

Node type name.

Math::vec3 getNodeDirection ()

Returns the normalized direction vector of the node. By default, a direction vector points along the mesh local -Z axis. It always has an unit length.

Return value

Normalized direction vector in the local space.

void setNodeScale (const Math::vec3 & s)

Updates the node scale.

Arguments

  • const Math::vec3 & s - New scale in the local space.

const char * getName ()

Returns a name of the node.

Return value

Name of the node.

Ptr<Node> clone ()

Clones the current node.

Return value

Cloned node.

Ptr<BodyRigid> getObjectBodyRigid ()

Return value

Ptr<Node> getNode (int id)

Returns a node pointer.

Arguments

  • int id - Node identifier.

Return value

Node pointer.

int setProperty (const char * name)

Sets a given property to the node.

Arguments

  • const char * name - Name of the property.

Return value

1 if the property is set successfully; otherwise, 0.

int restoreState (const Ptr<Stream> & stream)

Restores a node state from the stream.

Arguments

  • const Ptr<Stream> & stream - Stream smart pointer.

Return value

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

Math::Mat4 getWorldTransform ()

Returns the transformation matrix of the node in the world coordinates.

Return value

Transformation matrix.

void addChild (const Ptr<Node> & n)

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

Arguments

  • const Ptr<Node> & n - New child node.

int isQuery ()

Returns a value indicating if occlusion query is used for the node. The default is 0 (not used).

Return value

Returns 1 if occlusion query is used; otherwise, 0.

UNIGINE_BOUND_BOX getWorldBoundBox ()

Returns the world bounding box of the node.

Return value

World bounding box.

Ptr<Node> getPossessor ()

Returns 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.

Return value

Possessor node, if exists; otherwise, NULL.

Math::vec3 getNodeWorldDirection ()

Returns the normalized direction vector of the node. By default, a direction vector points along the mesh local -Z axis and is returned in world space coordinates. It always has the unit length.

Return value

Normalized direction vector in the world space.

int isSound ()

Returns a value indicating if a given node is a sound node.

Return value

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

void setNodeRotation (const Math::quat & rot, int identity = 0)

Updates the node rotation.

Arguments

  • const Math::quat & rot - New rotation in the local space.
  • int identity - 1 to enable scaling of the node, 0 to disable it.

int saveWorld (const Ptr<Xml> & xml)

Saves a node state into the Xml.

Arguments

  • const Ptr<Xml> & xml - Xml smart pointer.

Return value

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

void setWorldParent (const Ptr<Node> & n)

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

Arguments

  • const Ptr<Node> & n - New parent node.

int isObject ()

Returns a value indicating if a given node is an object node.

Return value

Return 1 if the given node is an object node; otherwise, 0.

Ptr<Node> getParent ()

Returns the parent of the node.

Return value

Parent node if exists; otherwise, NULL.

void renderVisualizer ()

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

int isField ()

Return value

Ptr<WorldSector> getWorldSector ()

Returns a sector, in which the node is located.

Return value

World sector.

int isChild (const Ptr<Node> & n)

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

Arguments

  • const Ptr<Node> & n - Node to check.

Return value

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

int findChild (const char * name)

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

Arguments

  • const char * name - Name of the child node.

Return value

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

Ptr<Body> getObjectBody ()

Return value

const char * getData ()

Returns 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.

Return value

User string data. Data can be an xml formatted string.

int isHandled ()

Returns a value indicating if the node handle is currently visible.

Return value

Returns 1 if the handle is shown; otherwise, 0.

int isEnabledSelf ()

Returns a value indicating if the node is enabled.

Return value

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

Math::Vec3 getNodePosition ()

Returns the node position.

Return value

The node position in the local space.

void removeWorldChild (const Ptr<Node> & n)

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

Arguments

  • const Ptr<Node> & n - Child node to remove.

int getNumChildren ()

Returns the number of child nodes.

Return value

Number of child nodes.

void setWorldTransform (const Math::Mat4 & transform)

Sets the transformation matrix for the node in the world coordinates.

Arguments

  • const Math::Mat4 & transform - Transformation matrix.

int isLight ()

Returns a value indicating if a given node is a light source.

Return value

Return 1 if the given node is a light source; otherwise, 0.

void setNodeWorldDirection (const Math::vec3 & dir, const Math::vec3 & up)

Updates the direction vector of the node. By default, a direction vector points along -Z axis. This function changes its direction and reorients the node.

Arguments

  • const Math::vec3 & dir - New direction vector in the world space. The direction vector always has unit length.
  • const Math::vec3 & up - New up vector in the world space.

const char * getPropertyName ()

Returns the name of a property associated with the node.

Return value

Property name, if exists; otherwise, NULL.

void setQuery (int query)

Updates a value indicating if occlusion query is used for the node.

Arguments

  • int query - Positive number to use occlusion query, 0 not to use.

int isFolded ()

Returns a value indicating if node children are shown or minimized in the node tree hierarchy.

Return value

Return Positive number if node children are hidden in the node tree; otherwise, 0.

int isDecal ()

Returns a value indicating if a given node is a decal.

Return value

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

int isPhysical ()

Returns a value indicating if a given node is a physical node.

Return value

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

Math::vec3 getNodeWorldScale ()

Returns scale of the node.

Return value

Scale in the local space.

void setNodeWorldRotation (const Math::quat & rot, int identity = 0)

Updates the node rotation.

Arguments

  • const Math::quat & rot - New rotation in the world space.
  • int identity - 1 to enable scaling of the node, 0 to disable it.

int isPlayer ()

Returns a value indicating if a given node is a player.

Return value

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

Math::Mat4 getTransform ()

Returns the transformation matrix of the node in its parent coordinates.

Return value

Transformation matrix.

int isEnabled ()

Returns a value indicating if the node and its parent nodes are enabled.

Return value

Returns 1 if the node and its parent nodes are enabled; otherwise, 0.

void setName (const char * name)

Sets a name for the node.

Arguments

  • const char * name - New name of the node.

int isCollider ()

Returns a value indicating if collision test is enabled for the node.

Return value

Returns 1 if collision test is enabled for the node; otherwise, 0.

int isSpatial ()

Returns a value indicating if sectors and portals are used for node visibility determination.

Return value

Returns 1 if sectors and portals are considered; otherwise, 0.

void setHandled (int handled)

Sets a value indicating if the node handle is visible. This option is valid only for invisible nodes, such as light and sound sources, particle systems and world-managing nodes (WorldSector, WorldPortal, triggers, expressions, etc.).

Arguments

  • int handled - Positive value to show the handle, 0 to hide it.

BoundBox getBoundBox ()

Returns the bounding box of the node.

Return value

The bounding box.

int 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.

Return value

Returns 1 if the node is updated last of all; otherwise, 0.

Math::vec3 getNodeScale ()

Returns scale of the node.

Return value

Scale in the local space.

void setClutter (int clutter)

Updates a value indicating if the node represents a clutter object.

Arguments

  • int clutter - Positive number to mark the node as a clutter object; otherwise, 0.

isExtern ()


int NODE_DUMMY

int NODE_LAYER

int NODE_PIVOT

int NODE_TRIGGER

int NODE_REFERENCE

int NODE_EXTERN

int WORLD_BEGIN

int WORLD_LAYER

Description

World layer. See the WorldLayer class.

int WORLD_SECTOR

Description

World sector. See the WorldSector class.

int WORLD_PORTAL

Description

World portal. See the WorldPortal class.

int WORLD_TRIGGER

Description

World trigger. See the WorldTrigger class.

int WORLD_CLUSTER

Description

Node cluster. See the WorldCluster class.

int WORLD_CLUTTER

Description

World clutter. See the WorldClutter class.

int WORLD_SWITCHER

Description

Node switcher (to switch off parts of the world). See the WorldSwitcher class.

int WORLD_OCCLUDER

Description

World occluder. See the WorldOccluder class.

int WORLD_OCCLUDER_MESH

Description

World mesh occluder. See the WorldOccluderMesh class.

int WORLD_OCCLUDER_TERRAIN

Description

World terrain occluder. See the WorldOccluderMesh class.

int WORLD_TRANSFORM_PATH

Description

Path defined transformer. See the WorldTransformPath

int WORLD_TRANSFORM_BONE

Description

Bone defined transformer. See the WorldTransformBone class.

int WORLD_EXPRESSION

Description

Node which allows to execute arbitrary expression. See the WorldExpression class.

int WORLD_EXTERN

Description

External world. See the WorldExtern class.

int WORLD_END

int GEODETIC_BEGIN

int GEODETIC_PIVOT

int GEODETIC_END

int FIELD_BEGIN

int FIELD_SPACER

Description

Field Spacer node.

int FIELD_ANIMATION

Description

Field Animation node.

int FIELD_END

int LIGHT_BEGIN

int LIGHT_ENVIRONMENT_PROBE

Description

Environment probe. See the LightEnvironmentProbe class.

int LIGHT_OMNI

Description

Omni-directional light source. See the LightOmni class.

int LIGHT_PROJ

Description

Projected light source. See the LightProj class.

int LIGHT_WORLD

Description

World light source. See the LightWorld class.

int LIGHT_END

int DECAL_BEGIN

int DECAL_PROJ

Description

Projected decal.

int DECAL_ORTHO

Description

Orthographic decal.

int DECAL_MESH

Description

Mesh decal.

int DECAL_END

int OBJECT_BEGIN

int OBJECT_DUMMY

Description

Dummy object. See the ObjectDummy class.

int OBJECT_DYNAMIC

Description

Dynamic object. See the ObjectDynamic class.

int OBJECT_MESH_STATIC

Description

Static mesh object. See the ObjectMeshStatic class.

int OBJECT_MESH_CLUSTER

Description

Mesh Cluster object. See the ObjectMeshCluster class.

int OBJECT_MESH_CLUTTER

Description

Mesh Clutter object. See the ObjectMeshClutter class.

int OBJECT_MESH_SKINNED

Description

Skinned mesh object. See the ObjectMeshSkinned class.

int OBJECT_MESH_DYNAMIC

Description

Dynamic mesh object. See the ObjectMeshDynamic class.

int OBJECT_TERRAIN

Description

Terrain object. See the ObjectTerrain class.

int OBJECT_GRASS

Description

Grass.

int OBJECT_PARTICLES

Description

Particles object. See the ObjectParticles class.

int OBJECT_BILLBOARDS

Description

Billboards object for rendering a high number of billboards. See the ObjectBillboard class.

int OBJECT_VOLUME_BOX

Description

Volume box object. See the ObjectVolumeBox class.

int OBJECT_VOLUME_SPHERE

Description

Volume sphere object. See the ObjectVolumeSphere class.

int OBJECT_VOLUME_OMNI

Description

Volume omni light object. See the ObjectVolumeOmni class.

int OBJECT_VOLUME_PROJ

Description

Volume projected light object. See the ObjectVolumeProj class.

int OBJECT_GUI

Description

GUI object. See the ObjectGui class.

int OBJECT_GUI_MESH

Description

GUI mesh object. See the ObjectGuiMesh class.

int OBJECT_WATER_GLOBAL

int OBJECT_WATER_MESH

Description

Water mesh object. See the ObjectWaterMesh class.

int OBJECT_SKY

Description

Sky object. See the ObjectSky class.

int OBJECT_EXTERN

Description

Extern object. See the ObjectExtern class.

int OBJECT_TEXT

Description

Text object. See the ObjectText class.

int OBJECT_END

int PLAYER_BEGIN

int PLAYER_DUMMY

Description

Dummy player. See the PlayerDummy class.

int PLAYER_SPECTATOR

Description

Observing player. See the PlayerSpectator class.

int PLAYER_PERSECUTOR

Description

Persecuting player. See the PlayerPersecutor class.

int PLAYER_ACTOR

Description

Acting player. See the PlayerActor class.

int PLAYER_END

int PHYSICAL_BEGIN

int PHYSICAL_WIND

Description

Physical wind object. See the PhysicalWind class.

int PHYSICAL_FORCE

Description

Physical force node that allows to simulate point forces applied to dynamic objects. See the PhysicalForce class.

int PHYSICAL_NOISE

Description

Physical noise node that allows to simulate force field.

int PHYSICAL_WATER

Description

Physical water object that has no visual representation. See the PhysicalWater class.

int PHYSICAL_TRIGGER

Description

Physical trigger. See the PhysicalTrigger class.

int PHYSICAL_END

int NAVIGATION_BEGIN

int NAVIGATION_SECTOR

Description

Sector within which pathfinding is performed.

int NAVIGATION_MESH

Description

Mesh-based navigation area across which pathfinding is performed.

int NAVIGATION_END

int OBSTACLE_BEGIN

int OBSTACLE_BOX

Description

Obstacle in the shape of a box avoided by pathfinding.

int OBSTACLE_SPHERE

Description

Obstacle in the shape of a sphere avoided by pathfinding.

int OBSTACLE_CAPSULE

Description

Obstacle in the shape of a capsule avoided by pathfinding.

int OBSTACLE_END

int SOUND_BEGIN

int SOUND_SOURCE

Description

Sound source. See the SoundSource class.

int SOUND_REVERB

Description

Sound reverberation zone. See the SoundReverb class.

int SOUND_END

int NUM_NODES

int NUM_WORLDS

int NUM_GEODETICS

int NUM_FIELDS

int NUM_LIGHTS

int NUM_DECALS

int NUM_OBJECTS

int NUM_PLAYERS

int NUM_PHYSICALS

int NUM_NAVIGATIONS

int NUM_OBSTACLES

int NUM_SOUNDS

int DUMMY

Description

Dummy node.

int LAYER

Description

Node layer containing parent layer and all its child nodes. See the NodeLayer class.

int PIVOT

Description

Node that helps to control rotation and transformation of its children.

int TRIGGER

Description

Dummy node that can fire callbacks on its enabling/disabling or repositioning. See the NodeTrigger class.

int REFERENCE

Description

Node that references an external NODE file. See the NodeReference class.

int EXTERN

Description

Extern node.
Last update: 2017-07-03