Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins

Node-Related Classes

New classes in this section:

Node Class

UNIGINEUNIGINE 2.0
NODE_OBJECT_MESHNODE_OBJECT_MESH_STATIC
NODE_WORLD_TRANSFORMNODE_WORLD_TRANSFORM_PATH
NODE_WORLD_SPACER-
NODE_LIGHT_CUBE-
NODE_WORLD_REVERB-
NODE_WORLD_SOURCE-
vec3 getBoundMax() BoundBox getBoundBox()
See details below.
vec3 getBoundMax() BoundBox getBoundBox()
See details below.
vec3 getBoundCenter() BoundSphere getBoundSphere()
See details below.
float getBoundRadius() BoundSphere getBoundSphere()
See details below.
vec3 getWorldBoundMax() BoundBox getWorldBoundBox()
See details below.
vec3 getWorldBoundMin() BoundBox getWorldBoundBox()
See details below.
vec3 getWorldBoundCenter() BoundSphere getWorldBoundSphere()
See details below.
float getWorldBoundRadius() BoundSphere getWorldBoundSphere()
See details below.
void setDirection(vec3 dir, vec3 up)-
void setWorldDirection(vec3 dir, vec3 up)-
int isImmovable()-
void setImmovable(int mode)-

NodeReference Class

UNIGINEUNIGINE 2.0
int setNodeName (string name) int setNodeName (string name, int addToWorld = 0)

Changes in Mesh-Related Classes

In UNIGINE 2.0, you can create a mesh via the Mesh class, add geometry to it, add animations and bones and then use it to create the following objects:

Each mesh-related node has the MeshName parameter that stores the internal mesh name. The mesh-related node loads its mesh from the file, specified in the MeshName parameter (if it is not empty).

If you change the mesh name via the setMeshName() function and save the *.world file, a new mesh will be loaded when you load the world the next time. You should also call the setMeshName() function after loading the new mesh via loadMesh() as it doesn't change the mesh name, for example:

Source code (UnigineScript)
// create the ObjectMeshStatic node with the "mesh_1.mesh" mesh name
ObjectMeshStatic mesh = new ObjectMeshStatic("mesh_1.mesh",0);
// load the new mesh from the file;
// the new "mesh_2.mesh" will be rendered, but the mesh name remains "mesh_1.mesh"
mesh.loadMesh("mesh_2.mesh");
// change the mesh name to "mesh_2.mesh";
// the mesh name will be updated in the *.world file and the "mesh_2.mesh" will be loaded the next time
mesh.setMeshName("mesh_2.mesh");
				

New Bounds-Related Classes

New BoundBox, BoundSphere and BoundFrustum classes have been added to the UnigineScript library. So, now you can operate with instances of these classes rather than dimensions of bounding box/sphere/frustum.

For example, you can get the bounding box of the object instead of getting its minimum and maximum.

  • In UNIGINE, you copy the bounding box of a static mesh by using 2 functions:
    Source code (UnigineScript)
    ObjectDynamic dynamic = new ObjectDynamic();
    ObjectMesh mesh = new ObjectMesh("samples/shaders/meshes/palm.mesh");
    // copy bounding box
    dynamic.setBoundBox(mesh.getBoundMin(0),mesh.getBoundMax(0));
    						
  • In UNIGINE 2.0, you can copy it by using a single function:
    Source code (UnigineScript)
    ObjectDynamic dynamic = new ObjectDynamic();
    ObjectMesh mesh = new ObjectMesh("samples/shaders/meshes/palm.mesh");
    // copy bounding box
    dynamic.setBoundBox(mesh.getBoundBox());
    						

Notice
Instances of the bounds-related classes are deleted automatically when it is necessary.

In case of double precision coordinates, the bounds are constructed by using the following classes:

  • WorldBoundBox for the bounding box
  • WorldBoundSphere for the bounding sphere
  • WorldBoundFrustum for the bounding frustum

If you want to support both single and double precision builds, you can use the WorldBoundBox/Sphere/Frustum classes only.

Last update: 2017-07-03