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
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.World Class

This class provides functionality for the world script. It contains methods required for loading the world with all its nodes, managing a spatial tree and handling nodes collisions and intersections.

Loading of nodes on demand is managed via the AsyncQueue Class.

Notice
C++ methods running editor script functions are described in the Engine class reference.

See also#

  • AsyncQueue Class to manage loading nodes and other resources on demand.
  • The Intersections article demonstrating how to use intersection-related functions

World Class

Properties

int NumUpdateNodes#

The number of currently updating nodes in the world.

bool IsUnpackNodeReferences#

The value indicating if automatic unpacking of node references at run time is enabled. This option can be used to simplify hierarchy management, as when it is enabled all nodes contained in node references will be present in the world hierarchy. When disabled you have to check the hierarchy of each node reference individually (e.g. to find the number of children or manage some of them). The content of NodeReference nodes is unpacked only at run time and does not affect your *.world and *.node files. So, you can use all advantages of node references when building worlds in the UnigineEditor and manage a clear and straightforward hierarchy at run time.
Notice
This option is available only via code, can be enabled in the System Script and works for all worlds used in your project.
Notice
This option is available only via code, can be enabled in the System Script and works for all worlds used in your project.
set
Enables or disables automatic unpacking of node references at run time. This option can be used to simplify hierarchy management, as when it is enabled all nodes contained in node references will be present in the world hierarchy. When disabled you have to check the hierarchy of each node reference individually (e.g. to find the number of children or manage some of them). The content of NodeReference nodes is unpacked only at run time and does not affect your *.world and *.node files. So, you can use all advantages of node references when building worlds in the UnigineEditor and manage a clear and straightforward hierarchy at run time.
Notice
This option is available only via code, can be enabled in the System Script and works for all worlds used in your project.
set value - 1 - to enable automatic unpacking of node references at run time, 0 - to disable it.

bool IsAutoReloadNodeReferences#

A value indicating if automatic reloading of nodereferences is enabled. if enabled all NodeReference nodes will reload their *.node files, when the saveNode() method is called.
Notice
This option can be used if you modify and save reference nodes at runtime. Otherwise you'll have to manually update pointers for all NodeReferences referring to the changed node.
set
Enables automatic reloading of NodeReferences. If enabled all NodeReference nodes will reload their *.node files, when the saveNode() method is called.
Notice
This option can be used if you modify and save reference nodes at runtime. Otherwise you'll have to manually update pointers for all NodeReferences referring to the changed node.
set value - 1 to enable automatic reloading of NodeReferences; 0 - to disable it. The default value is 0.

float UpdateGridSize#

The current size of the grid to be used for spatial tree update. the default value is an average one, and can be adjusted when necessary depending on the scene.
set
Sets the size of the grid to be used for spatial tree update. The default value is an average one, and can be adjusted when necessary depending on the scene.
set value - New grid size, in units. The default value is 1000 units.

float Distance#

A distance, at which (and farther) nothing will be rendered or simulated.
set
Updates the distance, at which (and farther) nothing will be rendered or simulated.
set value - New distance in units.

float Budget#

The value of the world generation budget for grass and clutter objects. new objects are not created when time is out of the budget.
set
Sets the world generation budget value for Grass and Clutter objects. New objects are not created when time is out of the budget.
set value - The budget value in seconds. The default value is 1/60.

string Data#

User string data associated with the world. this string is written directly into the data tag of the *.world file.
set
Sets user data associated with the world. In the *.world file, the data is set in the data tag.
set value - New user data.

bool IsLoaded#

A value indicating if the current world is fully loaded.

string ScriptName#

The name of the world script file *.usc.
set
Sets the name of the world script file *.usc.
set value - Name of the world script file *.usc.

string Name#

The name of the currently loaded world. (if a path was specified in the name, the returned string will contain both the world name and a path).
set
Sets a new name for the world.
set value - Name of the world.

string Path#

The current path to the *.world-file where the world is stored.
set
Sets the path to the *.world-file where the world is stored.
set value - Path to the *.world-file.

bool IsScriptExecute#

A value indicating if the world script (*.usc file) associated with the world should be executed.
set
Sets a value indicating if a logic script associated with the world is to be loaded with it.
set value - true - to load the world along with the associated logic script (if any), false - to ignore it.

Members


bool GetCollision ( WorldBoundBox bb, Object[] objects ) #

Searches for all collider objects within a given bounding box.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • WorldBoundBox bb - Bounding box.
  • Object[] objects - Array with collider objects' smart pointers.

Return value

1 if collider objects are found; otherwise, 0.

bool GetCollision ( WorldBoundSphere bs, Object[] objects ) #

Searches for all collider objects within a given bounding sphere.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • WorldBoundSphere bs - Bounding sphere.
  • Object[] objects - Array with collider objects' smart pointers.

Return value

1 if collider objects are found; otherwise, 0.

bool GetCollision ( Vec3 p0, Vec3 p1, Object[] objects ) #

Performs tracing from the p0 point to the p1 point to find all collider objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects.

Collisions with the surface can be found only if the following conditions are fulfilled:

  1. The surface is enabled.
  2. Per-surface Collision flag is enabled.
  3. The surface has a material assigned.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • Vec3 p0 - The start point coordinates.
  • Vec3 p1 - The end point coordinates.
  • Object[] objects - Array with collider objects' smart pointers.

Return value

1 if collider objects are found; otherwise, 0.

Object GetIntersection ( Vec3 p0, Vec3 p1, int mask, Vec3[] ret_point, vec3[] ret_normal, vec4[] ret_texcoord, int[] ret_index, int[] ret_instance, int[] ret_surface ) #

Performs tracing from the p0 point to the p1 point to find the first object intersecting the line. This function detects intersection with surfaces of a mesh. An intersection can be found only if an object is matching the intersection mask.

Intersections with the surface can be found only if the following conditions are fulfilled:

  1. The surface is enabled.
  2. Per-surface Intersection flag is enabled.
  3. The surface has a material assigned.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • int mask - Intersection mask. If 0 is passed, the function will return NULL.
  • Vec3[] ret_point - Intersection point of the line and object.
  • vec3[] ret_normal - Normal vector to the intersection point.
  • vec4[] ret_texcoord - Texture coordinates of the intersection point (vec4, where vec4.xy is for the first (0) UV channel, vec4.zw is for the second (1) UV channel).
  • int[] ret_index - Intersected triangle (polygon) number.
  • int[] ret_instance - Intersected instance number.
    Notice
    Intersected instance number can be obtained for the following classes:
  • int[] ret_surface - Intersected surface number.

Return value

Intersected object.

Object GetIntersection ( Vec3 p0, Vec3 p1, int mask, Node[] exclude, Vec3[] ret_point, vec3[] ret_normal, vec4[] ret_texcoord, int[] ret_index, int[] ret_instance, int[] ret_surface ) #

Performs tracing from the p0 point to the p1 point to find the first object intersecting the line. This function detects intersection with surfaces (polygons) of meshes. An intersection can be found only if an object is matching the intersection mask.

Intersections with the surface can be found only if the following conditions are fulfilled:

  1. The surface is enabled.
  2. Per-surface Intersection flag is enabled.
  3. The surface has a material assigned.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • int mask - Intersection mask. If 0 is passed, the function will return NULL.
  • Node[] exclude - The list of nodes to be excluded.
  • Vec3[] ret_point - Intersection point of the line and object.
  • vec3[] ret_normal - Normal vector to the intersection point.
  • vec4[] ret_texcoord - Texture coordinates of the intersection point (vec4, where vec4.xy is for the first (0) UV channel, vec4.zw is for the second (1) UV channel).
  • int[] ret_index - Intersected triangle (polygon) number.
  • int[] ret_instance - Intersected instance number.
    Notice
    Intersected instance number can be obtained for the following classes:
  • int[] ret_surface - Intersected surface number.

Return value

Intersected object.

Object GetIntersection ( Vec3 p0, Vec3 p1, int mask, WorldIntersection intersection ) #

Performs tracing from the p0 point to the p1 point to find the first object intersecting the line. This function detects intersection with surfaces (polygons) of meshes. An intersection can be found only if an object is matching the intersection mask.

Intersections with the surface can be found only if the following conditions are fulfilled:

  1. The surface is enabled.
  2. Per-surface Intersection flag is enabled.
  3. The surface has a material assigned.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • int mask - Intersection mask. If 0 is passed, the function will return NULL.
  • WorldIntersection intersection - WorldIntersection object to be filled.

Return value

First intersected object.

Object GetIntersection ( Vec3 p0, Vec3 p1, int mask, WorldIntersectionNormal intersection ) #

Performs tracing from the p0 point to the p1 point to find the first object intersecting the line. This function detects intersection with surfaces (polygons) of meshes. An intersection can be found only if an object is matching the intersection mask.

Intersections with the surface can be found only if the following conditions are fulfilled:

  1. The surface is enabled.
  2. Per-surface Intersection flag is enabled.
  3. The surface has a material assigned.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • int mask - Intersection mask. If 0 is passed, the function will return NULL.
  • WorldIntersectionNormal intersection - WorldIntersectionNormal object to be filled.

Return value

First intersected object.

Object GetIntersection ( Vec3 p0, Vec3 p1, int mask, WorldIntersectionTexCoord intersection ) #

Performs tracing from the p0 point to the p1 point to find the first object intersecting the line. This function detects intersection with surfaces (polygons) of meshes. An intersection can be found only if an object is matching the intersection mask.

Intersections with the surface can be found only if the following conditions are fulfilled:

  1. The surface is enabled.
  2. Per-surface Intersection flag is enabled.
  3. The surface has a material assigned.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • int mask - Intersection mask. If 0 is passed, the function will return NULL.
  • WorldIntersectionTexCoord intersection - WorldIntersectionTexCoord object to be filled.

Return value

First intersected object.

Object GetIntersection ( Vec3 p0, Vec3 p1, int mask, Node[] exclude, WorldIntersection intersection ) #

Performs tracing from the p0 point to the p1 point to find the first object intersecting the line. This function detects intersection with surfaces (polygons) of meshes. An intersection can be found only if an object is matching the intersection mask.

Intersections with the surface can be found only if the following conditions are fulfilled:

  1. The surface is enabled.
  2. Per-surface Intersection flag is enabled.
  3. The surface has a material assigned.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • int mask - Intersection mask. If 0 is passed, the function will return NULL.
  • Node[] exclude - The list of nodes to be excluded.
  • WorldIntersection intersection - WorldIntersection object to be filled.

Return value

First intersected object.

Object GetIntersection ( Vec3 p0, Vec3 p1, int mask, Node[] exclude, WorldIntersectionNormal intersection ) #

Performs tracing from the p0 point to the p1 point to find the first object intersecting the line. This function detects intersection with surfaces (polygons) of meshes. An intersection can be found only if an object is matching the intersection mask.

Intersections with the surface can be found only if the following conditions are fulfilled:

  1. The surface is enabled.
  2. Per-surface Intersection flag is enabled.
  3. The surface has a material assigned.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • int mask - Intersection mask. If 0 is passed, the function will return NULL.
  • Node[] exclude - The list of nodes to be excluded.
  • WorldIntersectionNormal intersection - WorldIntersectionNormal object to be filled.

Return value

First intersected object.

Object GetIntersection ( Vec3 p0, Vec3 p1, int mask, Node[] exclude, WorldIntersectionTexCoord intersection ) #

Performs tracing from the p0 point to the p1 point to find the first object intersecting the line. This function detects intersection with surfaces (polygons) of meshes. An intersection can be found only if an object is matching the intersection mask.

Intersections with the surface can be found only if the following conditions are fulfilled:

  1. The surface is enabled.
  2. Per-surface Intersection flag is enabled.
  3. The surface has a material assigned.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • int mask - Intersection mask. If 0 is passed, the function will return NULL.
  • Node[] exclude - The list of nodes to be excluded.
  • WorldIntersectionTexCoord intersection - WorldIntersectionTexCoord object to be filled.

Return value

First intersected object.

bool GetIntersection ( Vec3 p0, Vec3 p1, Object[] objects ) #

Performs tracing from the p0 point to the p1 point to find objects that intersecting the line. This function detects intersection with surfaces (polygons) of meshes. An intersection can be found only if an object is matching the intersection mask.

Intersections with the surface can be found only if the following conditions are fulfilled:

  1. The surface is enabled.
  2. Per-surface Intersection flag is enabled.
  3. The surface has a material assigned.
Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • Vec3 p0 - Coordinates of the line start point.
  • Vec3 p1 - Coordinates of the line end point.
  • Object[] objects - Array of intersected objects.

Return value

1 if intersections are found; otherwise, 0.

bool GetIntersection ( WorldBoundBox bb, Object[] objects ) #

Searches for intersections with objects that are found in a given bounding box.

Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • WorldBoundBox bb - Bounding box where intersection search will be performed.
  • Object[] objects - Array of intersected objects.

Return value

1 if intersections are found; otherwise, 0.

bool GetIntersection ( WorldBoundSphere bs, Object[] objects ) #

Searches for intersections with objects that are found in a given bounding sphere.

Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • WorldBoundSphere bs - Bounding sphere where intersection search will be performed.
  • Object[] objects - Array of intersected objects.

Return value

1 if intersections are found; otherwise, 0.

bool GetIntersection ( WorldBoundFrustum bf, Object[] objects ) #

Searches for intersections with objects that are found in a given bounding frustum.

Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • WorldBoundFrustum bf - Bounding frustum where intersection search will be performed.
  • Object[] objects - Array of intersected objects.

Return value

1 if intersections are found; otherwise, 0.

bool GetIntersection ( WorldBoundBox bb, Node[] nodes ) #

Searches for intersections with nodes that are found in a given bounding box.

Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • WorldBoundBox bb - Bounding box where intersection search will be performed.
  • Node[] nodes - Array of intersected nodes.

Return value

1 if intersections are found; otherwise, 0.

bool GetIntersection ( WorldBoundSphere bs, Node[] nodes ) #

Searches for intersections with nodes that are found in a given bounding sphere.

Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • WorldBoundSphere bs - Bounding sphere where intersection search will be performed.
  • Node[] nodes - Array of intersected nodes.

Return value

1 if intersections are found; otherwise, 0.

bool GetIntersection ( WorldBoundBox bb, Node.TYPE type, Node[] nodes ) #

Searches for intersections with specified type of nodes that are found in a given bounding box.

Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • WorldBoundBox bb - Bounding box where intersection search will be performed.
  • Node.TYPE type - Node type filter. Only the nodes of the specified type will be checked.
  • Node[] nodes - Array of intersected nodes.

Return value

1 if intersections are found; otherwise, 0.

bool GetIntersection ( WorldBoundSphere bs, Node.TYPE type, Node[] nodes ) #

Searches for intersections with specified type of nodes that are found in a given bounding sphere.

Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • WorldBoundSphere bs - Bounding sphere where intersection search will be performed.
  • Node.TYPE type - Node type filter. Only the nodes of the specified type will be checked.
  • Node[] nodes - Array of intersected nodes.

Return value

1 if intersections are found; otherwise, 0.

bool GetIntersection ( WorldBoundFrustum bf, Node.TYPE type, Node[] nodes ) #

Searches for intersections with specified type of nodes that are found in a given bounding frustum.

Notice
As a new node becomes a part of the BSP tree only after the updateSpatial() method is called (the engine calls the method automatically each frame after the world script update() code is executed), all engine subsystems can process this node only in the next frame. If you need to get the node in the very first frame, call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

Arguments

  • WorldBoundFrustum bf - Bounding frustum where intersection search will be performed.
  • Node.TYPE type - Node type filter. Only the nodes of the specified type will be checked.
  • Node[] nodes - Array of intersected nodes.

Return value

1 if intersections are found; otherwise, 0.

int LoadWorld ( string name ) #

Loads a world from a file and replaces the current world with it.

Arguments

Return value

1 if the world is loaded successfully; otherwise, 0.

Node GetNode ( int id ) #

Returns a node by its ID. This can be any node: either created dynamically in run-time or loaded from the *.world file.

Arguments

  • int id - Node ID.

Return value

Node smart pointer if the node with the specified ID exists; otherwise, NULL.

bool IsNode ( int id ) #

Checks if a node with a given ID exists in the world.

Arguments

  • int id - Node ID.

Return value

1 if the node with the given ID exists; otherwise, 0.

void GetNodes ( Node[] nodes ) #

Gets all nodes (either loaded from the *.world file or created dynamically at run time).

Arguments

  • Node[] nodes - Return array with node smart pointers.

Node GetUpdateNode ( int num ) #

Returns an updated node by its ID.

Arguments

  • int num - Node ID.

Return value

The node smart pointer, if found; otherwise - 0.

void AddUpdateNode ( Node node ) #

Adds a node that should be updated even if it is outside of the viewing frustum. This function should be called every frame.

Arguments

  • Node node - Node to be updated.

void AddUpdateNodes ( Node[] nodes ) #

Adds a node array that should be updated even if the nodes are outside of the viewing frustum. This function should be called every frame.

Arguments

  • Node[] nodes - Nodes array to be updated.

int AddWorld ( string name ) #

Loads a world from a file and adds it to the current world.

Arguments

Return value

1 if the world is loaded and added successfully; otherwise, 0.

int ClearNode ( string name ) #

Clears a cache of a given node.

Arguments

  • string name - File with the node.

Return value

1 if the cache is cleared successfully; otherwise, 0.

Node LoadNode ( string name, int cache = 1 ) #

Loads a node from a file. If the node is loaded successfully, it does not belong to any node hierarchy or list, so be careful and make sure to handle it properly, when it is no longer needed.

Arguments

  • string name - Path to the *.node file.
  • int cache - 1 to use the file cache, 0 not to use.

Return value

Loaded node; NULL if the node cannot be loaded.

int LoadNodes ( string name, Node[] nodes ) #

Loads nodes from a file.

Arguments

  • string name - Path to the *.node file.
  • Node[] nodes - Array of nodes' smart pointers to which the loaded nodes are appended.

Return value

1 if the nodes are loaded successfully; otherwise, 0.

int SaveNode ( string name, Node node, int binary = 0 ) #

Saves a given node to a file.

Arguments

  • string name - Path to the *.node file.
  • Node node - Pointer to the node to save.
  • int binary - If set to 1, the node is saved to the binary *.xml. This file cannot be read, but using it speeds up the saving of the node and requires less disk space.

Return value

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

int SaveNodes ( string name, Node[] nodes, int binary = 0 ) #

Saves nodes to a file.

Arguments

  • string name - Path to the *.node file.
  • Node[] nodes - Array of nodes' smart pointers to be saved.
  • int binary - If set to 1, the node is saved to the binary *.xml. This file cannot be read, but using it speeds up the saving of the node and requires less disk space.

Return value

1 if the nodes are saved successfully; otherwise, 0.

void UpdateSpatial ( ) #

Updates the node BSP (binary space partitioning) tree.

The engine calls this method automatically each frame after the world script update() code is executed. As a new node becomes a part of the BSP tree only after this method is called, all engine subsystems (renderer, physics, sound, pathfinding, collisions, intersections, etc.) can process this node only in the next frame. If you need the subsystem to process the node in the very first frame, you can call the updateSpatial() method manually. The engine will call this method automatically after the update() code is executed anyways.

int RemoveNode ( Node node, int with_children = 1 ) #

Deletes a given node completely.

Arguments

  • Node node - Node to be removed
  • int with_children - 1 — update the target parent nodes along with all their children nodes; 0 — update the target parent nodes without their children nodes.

Return value

1 if the node is removed successfully; otherwise, 0.

void SetScriptExecute ( bool execute ) #

Sets a value indicating if a logic script associated with the world is to be loaded with it.

Arguments

  • bool execute - true - to load the world along with the associated logic script (if any), false - to ignore it.

bool IsScriptExecute ( ) #

Returns a value indicating if a logic script associated with the world is to be loaded with it.

Return value

true if a logic script associated with the world is to be loaded with it; otherwise, false.

bool ReleaseNode ( Node node ) #

Releases the specified node. After calling this method the node shall no longer be owned by the world, and won't be deleted automatically on closing the world.

Arguments

  • Node node - Node to be released by the world.

Return value

true if the specified node was successfully released by the world; otherwise, false.

bool GrabNode ( Node node ) #

Arguments

  • Node node - Node to be grabbed by the world.

Return value

true if the specified node was successfully grabbed by the world; otherwise, false.Grabs the specified node. After calling this method the node shall be owned by the world, and shall be automatically deleted on closing the world.
Last update: 2019-08-16
Build: ()