This page has been translated automatically.
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
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility 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.

World Class

The set of functions describes how to load the world with all its nodes, manage a spatial tree and handle nodes collisions and intersections.

World Class

Members


Object getIntersection (Vec3 p0, Vec3 p1, int mask, Vector<Node> exclude, Vec3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int * ret_surface)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • Vec3 p0 - The start point coordinates.
  • Vec3 p1 - The end point coordinates.
  • int mask - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.
  • Vector<Node> exclude - The list of objects IDs to exclude.
  • Vec3 * ret_point - The variable.
  • 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_surface - Intersected surface number.

Return value

The reference to the first intersected object, if found; otherwise - 0.

int getIntersection (WorldBoundFrustum bf, Vector<Object> & objects)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • WorldBoundFrustum bf - The start point coordinates.
  • Vector<Object> & objects - The end point coordinates.

Return value

The reference to the first intersected object, if found; otherwise - 0.

int forceAsyncNode (int id)

Forces the loading of the node (the specified node gets the higher priority and will be loaded first).

Arguments

Return value

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

void setData (string data)

Updates user data associated with the node.

Arguments

  • string data - New user data.

int getIntersection (WorldBoundSphere bs, Vector<Node> & nodes)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • WorldBoundSphere bs - The start point coordinates.
  • Vector<Node> & nodes - The end point coordinates.

Return value

The reference to the first intersected object, if found; otherwise - 0.

void setName (string name)

Assigns a new name to an editable world.

Arguments

  • string name - Name of the world.

int getNumQueuedNodes ()

Returns the number of queued nodes waiting for the background loading. The return value also includes the currently processed node. To add node for the background loading, use the engine.world.loadAsyncNode() function.

Return value

Number of queued nodes including the currently processed node.

int checkAsyncNode (int id)

Checks if the node is in the loading queue or already loaded.

Arguments

Return value

1 if the node is in the loading queue or already loaded; otherwise, 0.

void setDistance (float distance)

Updates the distance, at which (and farther) nothing will be rendered or simulated.

Arguments

  • float distance - New distance in units.

void setBudget (float budget)

Sets the world generation budget value for Grass and Clutter objects. New objects are not created when time is out of the budget.

Arguments

  • float budget - The budget value in seconds. The default value is 1/60.

int getNumUpdateNodes ()

Returns the number of currently updating nodes in the world.

Return value

Number of updating nodes.

int getIntersection (Vec3 p0, Vec3 p1, Vector<Object> & objects)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • Vec3 p0 - The start point coordinates.
  • Vec3 p1 - The end point coordinates.
  • Vector<Object> & objects - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.

Return value

The reference to the first intersected object, if found; otherwise - 0.

Node getAsyncNode (int id)

Gets the loaded node. If the loaded node consists of multiple objects, a new dummy object to combine them is created and its smart pointer is returned.

Arguments

Return value

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

int getNumQueuedResources ()

Returns the number of queued resources waiting for the background loading. The return value also includes the currently processed node.

Return value

Number of queued resources including the currently processed resource.

int removeAsyncNode (int id)

Removes the node from the loading queue.

Arguments

Return value

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

void addUpdateNode (Node node)

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

Arguments

  • Node node - Node to be updated.

int clearNode (string name)

Clears a cache of the given NodeReference.

Arguments

  • string name - File with the node.

Return value

1 if the cache was successfully cleaned; otherwise, 0.

int loadAsyncNode (string name, int group = 0, float weight = 0.0f)

Loads the node with the specified group and priority to the thread.

Arguments

  • string name - The name of the node.
  • int group - The number of the node group.
  • float weight - The priority of the node.

Return value

The loading operation identifier.

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.

Object getIntersection (Vec3 p0, Vec3 p1, int mask, Vec3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int * ret_surface)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • Vec3 p0 - The start point coordinates.
  • Vec3 p1 - The end point coordinates.
  • int mask - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.
  • Vec3 * ret_point - The list of objects IDs to exclude.
  • vec3 * ret_normal - The variable.
  • 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_surface - Intersected surface number.

Return value

The reference to the first intersected object, if found; otherwise - 0.

int getIntersection (WorldBoundSphere bs, int type, Vector<Node> & nodes)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • WorldBoundSphere bs - The start point coordinates.
  • int type - The end point coordinates.
  • Vector<Node> & nodes - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.

Return value

The reference to the first intersected object, if found; otherwise - 0.

float getTotalTime ()

Returns the total time (in milliseconds) of loading a resource.

Return value

The total time value, milliseconds.

int getIntersection (WorldBoundBox bb, int type, Vector<Node> & nodes)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • WorldBoundBox bb - The start point coordinates.
  • int type - The end point coordinates.
  • Vector<Node> & nodes - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.

Return value

The reference to the first intersected object, if found; otherwise - 0.

Object getIntersection (Vec3 p0, Vec3 p1, int mask, WorldIntersectionTexCoord v)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • Vec3 p0 - The start point coordinates.
  • Vec3 p1 - The end point coordinates.
  • int mask - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.
  • WorldIntersectionTexCoord v - The list of objects IDs to exclude.

Return value

The reference to the first intersected object, if found; otherwise - 0.

Object getIntersection (Vec3 p0, Vec3 p1, int mask, Vector<Node> exclude, WorldIntersection v)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • Vec3 p0 - The start point coordinates.
  • Vec3 p1 - The end point coordinates.
  • int mask - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.
  • Vector<Node> exclude - The list of objects IDs to exclude.
  • WorldIntersection v - The variable.

Return value

The reference to the first intersected object, if found; otherwise - 0.

int isNode (int id)

Checks a given node for validity. Either a node itself can be passed or the node ID.

Arguments

  • int id - A node or its ID to test.

Return value

1 if the variable holds a valid Node instance; otherwise, 0.

Node getNode (int id)

Returns a node by its ID. This can be any node: either created in scripts or loaded from the *.world file.
Notice
See also engine.editor.getNodeByName() and engine.editor.getNode() functions to get nodes loaded from the *.world file.

Arguments

  • int id - Node ID.

Return value

Requested node, if found (NULL otherwise).

float getDistance ()

Returns a distance, at which (and farther) nothing will be rendered or simulated.

Return value

Distance in units.

string getName ()

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

Return value

Name of the current world.

Object getIntersection (Vec3 p0, Vec3 p1, int mask, WorldIntersection v)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • Vec3 p0 - The start point coordinates.
  • Vec3 p1 - The end point coordinates.
  • int mask - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.
  • WorldIntersection v - The list of objects IDs to exclude.

Return value

The reference to the first intersected object, if found; otherwise - 0.

Object getIntersection (Vec3 p0, Vec3 p1, int mask, Vector<Node> exclude, WorldIntersectionTexCoord v)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • Vec3 p0 - The start point coordinates.
  • Vec3 p1 - The end point coordinates.
  • int mask - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.
  • Vector<Node> exclude - The list of objects IDs to exclude.
  • WorldIntersectionTexCoord v - The variable.

Return value

The reference to the first intersected object, if found; otherwise - 0.

float getBudget ()

Returns the value of the world generation budget for Grass and Clutter objects. New objects are not created when time is out of the budget.

Return value

The budget value in seconds.

void updateSpatial ()

Updates the BSP tree. This function is automatically called each frame. This function is called manually if a new object was added through the script and it needs to participate in spatial intersection during one and the same frame. Or if you have moved the node, and then want to get callbacks on basis of changed position in the same frame.
You may want to call updateSpatial() before: You can call updateSpatial() several times during one frame, but do not use it once too many times. It is more rational to change position of all required nodes first and only after that call updateSpatial().

Object getIntersection (Vec3 p0, Vec3 p1, int mask, WorldIntersectionNormal v)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • Vec3 p0 - The start point coordinates.
  • Vec3 p1 - The end point coordinates.
  • int mask - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.
  • WorldIntersectionNormal v - The list of objects IDs to exclude.

Return value

The reference to the first intersected object, if found; otherwise - 0.

Object getIntersection (Vec3 p0, Vec3 p1, int mask, Vector<Node> exclude, WorldIntersectionNormal v)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • Vec3 p0 - The start point coordinates.
  • Vec3 p1 - The end point coordinates.
  • int mask - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.
  • Vector<Node> exclude - The list of objects IDs to exclude.
  • WorldIntersectionNormal v - The variable.

Return value

The reference to the first intersected object, if found; otherwise - 0.

int getIntersection (WorldBoundFrustum bf, int type, Vector<Node> & nodes)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • WorldBoundFrustum bf - The start point coordinates.
  • int type - The end point coordinates.
  • Vector<Node> & nodes - An intersection mask.
    Notice
    If 0 is passed, the function will return NULL.

Return value

The reference to the first intersected object, if found; otherwise - 0.

string getData ()

Returns user string data associated with the node. This string is written directly into a *.world file.

Return value

User string data.

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 getIntersection (WorldBoundBox bb, Vector<Object> & objects)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • WorldBoundBox bb - The start point coordinates.
  • Vector<Object> & objects - The end point coordinates.

Return value

The reference to the first intersected object, if found; otherwise - 0.

void getNodes (Vector<Node> & nodes)

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

Arguments

  • Vector<Node> & nodes - Return array with node smart pointers.

int isLoaded ()

Returns a value indicating if the current world is fully loaded.

Return value

1 if the world is loaded; otherwise, 0.

int getIntersection (WorldBoundSphere bs, Vector<Object> & objects)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • WorldBoundSphere bs - The start point coordinates.
  • Vector<Object> & objects - The end point coordinates.

Return value

The reference to the first intersected object, if found; otherwise - 0.

int getIntersection (WorldBoundBox bb, Vector<Node> & nodes)

Performs tracing from the p0 point to the p1 point to find the list of objects intersecting the line. This function detects intersection with surfaces (polygons) of mesh and terrain objects. An intersection is 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. A per-surface Intersection flag is enabled.
  2. An Intersection option of the property in the Properties window is enabled.
  3. A surface is enabled.
  4. A surface has an assigned material.
  5. A surface has an assigned property.

Depending on the variable passed as an argument, the result will be presented as following:

Arguments

  • WorldBoundBox bb - The start point coordinates.
  • Vector<Node> & nodes - The end point coordinates.

Return value

The reference to the first intersected object, if found; otherwise - 0.

get (string function)

Arguments

  • string function

call (Variable function, Variable arg0, Variable arg1, Variable arg2, Variable arg3)

Arguments

  • Variable function
  • Variable arg0
  • Variable arg1
  • Variable arg2
  • Variable arg3

call (Variable function, Variable arg0)

Arguments

  • Variable function
  • Variable arg0

set (string function, Variable value)

Arguments

  • string function
  • Variable value

call (Variable function, Variable arg0, Variable arg1)

Arguments

  • Variable function
  • Variable arg0
  • Variable arg1

call (Variable function, Variable arg0, Variable arg1, Variable arg2, Variable arg3, Variable arg4)

Arguments

  • Variable function
  • Variable arg0
  • Variable arg1
  • Variable arg2
  • Variable arg3
  • Variable arg4

call (Variable function, int id = [])

Arguments

  • Variable function
  • int id

call (Variable function, Variable arg0, Variable arg1, Variable arg2, Variable arg3, Variable arg4, Variable arg5)

Arguments

  • Variable function
  • Variable arg0
  • Variable arg1
  • Variable arg2
  • Variable arg3
  • Variable arg4
  • Variable arg5

call (Variable function, Variable arg0, Variable arg1, Variable arg2)

Arguments

  • Variable function
  • Variable arg0
  • Variable arg1
  • Variable arg2

call (Variable function)

Arguments

  • Variable function
Last update: 2017-07-03
Build: ()