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

Object Class

Interface for object handling. See also the UnigineScript analog.

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

Object Class

Members


void setMaxFadeDistance (float distance, int surface)

Updates maximum fade-out distance of a given surface. Across this distance the surface smoothly becomes invisible due to alpha fading. It is counted off starting from the maximum visibility distance.

Arguments

  • float distance - Maximum fade-out distance of the surface. The default is 0.
  • int surface - Surface number in range from 0 to number of surfaces.

int getIntersection (const Math::vec3 & p0, const Math::vec3 & p1, const Ptr<ObjectIntersectionTexCoord> & v, int surface)

Returns a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • const Math::vec3 & p0 - ID number of the surface.
  • const Math::vec3 & p1 - End point coordinates.
  • const Ptr<ObjectIntersectionTexCoord> & v - Variable used to control which type of intersection object will be returned:
  • int surface - Surface number.

Return value

Surface intersection flag.

int findSurface (const char * name)

Searches for an object surface with a given name.

Arguments

  • const char * name - Surface name.

Return value

Surface number if it exists; otherwise, -1.

int getMinParent (int surface)

Return the surface minimum LOD parent surface number.

Arguments

  • int surface - Surface number.

Return value

Surface minimum LOD parent surface number.

int getCastWorldShadow (int surface)

Returns a cast world shadow flag for a given surface. This flag indicates if the surface should cast shadows from world lights.

Arguments

  • int surface - Surface number.

Return value

Cast world shadow flag set for the surface.

const char * getMaterialName (int surface)

Returns the name of the material applied to a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Material name.

void setCollisionMask (int mask, int surface)

Sets a collision mask for a given surface. Two objects collide, if they both have matching masks.

Arguments

  • int mask - Surface collision mask.
  • int surface - Surface number.

BoundSphere getBoundSphere (int surface)

Returns the bounding sphere of a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Bounding sphere.

int getPropertyState (const char * name, int surface)

Returns a state value of a given surface property.

Arguments

  • const char * name - Material state name.
  • int surface - ID number of the surface.

Return value

State value.

int getIntersection (int surface)

Returns a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • int surface - Surface number.

Return value

Surface intersection flag.

int getNumTriangles (int surface)

Returns the number of triangles comprising a given surface.

Arguments

  • int surface - ID number of the surface.

Return value

Number of triangles.

void setViewportMask (int mask, int surface)

Sets a viewport mask for a given surface. The object surface is rendered, if its mask matches the player (camera), light source and material masks.

Arguments

  • int mask - Surface viewport mask (integer, each bit of which is a mask).
  • int surface - Surface number.

Ptr<Property> getProperty (int surface)

Returns the property smart pointer.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Property smart pointer.

int isEnabled (int surface)

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

Arguments

  • int surface - ID number of the surface.

Return value

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

const char * getMaterialTexture (const char * name, int surface)

Returns a path to a given texture of a given surface material.

Arguments

  • const char * name - Material texture name.
  • int surface - ID number of the surface.

Return value

Path to the texture file.

Ptr<Object> getObject ()

Returns an object pointer.

Return value

Object pointer.

Math::vec4 getMaterialParameter (const char * name, int surface)

Returns a value of a given parameter of the surface material.

Arguments

  • const char * name - Name of the parameter.
  • int surface - ID number of the surface.

Return value

Value of the parameter.

void setBody (const Ptr<Body> & body, int update = 1)

Arguments

  • const Ptr<Body> & body
  • int update

void setIntersectionMask (int mask, int surface)

Sets an intersection mask for a given surface.

Arguments

  • int mask - Surface intersection mask (integer, each bit of which is a mask).
  • int surface - Surface number.

void setIntersection (int enabled, int surface)

Sets a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • int enabled - Surface intersection flag.
  • int surface - Surface number.

void setMaterialTexture (const char * name, const char * texture, int surface)

Sets a path to a given texture of a given surface material.

Arguments

  • const char * name - Material texture name.
  • const char * texture - Path to the texture file.
  • int surface - ID number of the surface.

UNIGINE_BOUND_SPHERE getWorldBoundSphere (int surface)

Returns the world bounding sphere of a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

World bounding sphere (in world coordinates).

void setMaterialState (const char * name, int state, int surface)

Sets a state value for a given surface material.

Arguments

  • const char * name - Material state name.
  • int state - State value.
  • int surface - ID number of the surface.

int isFolded (int surface)

Returns a value indicating if surface children are displayed of minimized in the surface hierarchy.

Arguments

  • int surface - Surface number.

Return value

Positive number if surface children are hidden in the surface hierarchy; otherwise, 0.

int isPropertyInherited (int surface)

Returns a value indicating if a given property is inherited.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Returns 1 if the surface property is inherited.

void setFolded (int folded, int surface)

Shows or minimizes surface children in the surface hierarchy.

Arguments

  • int folded - Positive number to minimize surface children, 0 to expand the hierarchy.
  • int surface - Surface number.

int getMaxParent (int surface)

Returns a surface maximum LOD parent surface number.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Surface maximum LOD parent surface number.

void setCastShadow (int enabled, int surface)

Sets a surface cast shadow flag, which indicates if a given object surface should cast shadows from non-world lights.

Arguments

  • int enabled - Surface cast shadow flag.
  • int surface - Surface number.

UNIGINE_BOUND_BOX getWorldBoundBox (int surface)

Returns the world bounding box of a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

World bounding box (in world coordinates).

int getIntersection (const Math::vec3 & p0, const Math::vec3 & p1, const Ptr<ObjectIntersectionNormal> & v, int surface)

Returns a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • const Math::vec3 & p0 - ID number of the surface.
  • const Math::vec3 & p1 - End point coordinates.
  • const Ptr<ObjectIntersectionNormal> & v - Variable used to control which type of intersection object will be returned:
  • int surface - Surface number.

Return value

Surface intersection flag.

int getMaterialState (const char * name, int surface)

Returns a state value of a given surface material.

Arguments

  • const char * name - Material state name.
  • int surface - ID number of the surface.

Return value

State value.

float getMinVisibleDistance (int surface)

Returns minimum visibility distance of a given surface (the distance, starting from which the surface begins fading in and then is completely visible).

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Minimum visibility distance.

int setProperty (const char * name, const char * pattern)

Sets a property for a given surface.

Arguments

  • const char * name - Name of the new property.
  • const char * pattern - Surface number in range from 0 to number of surfaces.

Return value

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

int getParent (int surface)

Returns the number of a parent surface of a given surface.

Arguments

  • int surface - Surface number in range from 0 to the number of object surfaces.

Return value

Parent surface number. If -1 is returned, the parent surface is not specified for the given surface.

void setCastWorldShadow (int enabled, int surface)

Sets a cast world shadow flag for a given surface. This flag indicates if the surface should cast shadows from world lights.

Arguments

  • int enabled - Cast world shadow flag to set for the surface.
  • int surface - Surface number.

float getMaxFadeDistance (int surface)

Returns maximum fade-out distance of a given surface. Across this distance the surface smoothly becomes invisible due to alpha fading. It is counted off starting from the maximum visibility distance.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Maximum fade-out distance of the surface.

void setMaxVisibleDistance (float distance, int surface)

Updates maximum visibility distance of a given surface (the distance, from which the surface begins fading out until completely invisible).

Arguments

  • float distance - Maximum visibility distance. The default is inf.
  • int surface - Surface number in range from 0 to number of surfaces.

int getIntersection (const Math::vec3 & p0, const Math::vec3 & p1, int mask, const Ptr<ObjectIntersection> & v, int * ret_surface)

Returns a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • const Math::vec3 & p0 - ID number of the surface.
  • const Math::vec3 & p1 - End point coordinates.
  • int mask - Variable used to control which type of intersection object will be returned:
  • const Ptr<ObjectIntersection> & v - Surface number.
  • int * ret_surface

Return value

Surface intersection flag.

int getCollisionMask (int surface)

Returns a collision mask for a given surface. Two objects collide, if they both have matching masks.

Arguments

  • int surface - Surface number.

Return value

Surface collision mask.

int getLightMask (int surface)

Returns a light mask for a given surface.

Arguments

  • int surface - Surface number.

Return value

Surface light mask (integer, each bit of which is a mask).

void setMaterialParameter (const char * name, const Math::vec4 & parameter, int surface)

Sets a value of a given parameter of the surface material.

Arguments

  • const char * name - Name of the parameter.
  • const Math::vec4 & parameter - Value of the parameter.
  • int surface - ID number of the surface.

void flushBodyTransform ()

Forces to set the transformations of the body for the node.

void setParent (int parent, int surface)

Sets or clears the number of a parent surface of a given surface.

Arguments

  • int parent - Parent surface number in range from -1 to the number of object surfaces; -1 is used to clear the parent surface.
  • int surface - Surface number in range from 0 to the number of object surfaces.

void setLightMask (int mask, int surface)

Sets a light mask for a given surface.

Arguments

  • int mask - Surface light mask (integer, each bit of which is a mask).
  • int surface - Surface number.

float getMinFadeDistance (int surface)

Returns minimum fade-in distance of a given surface. Across this distance the surface smoothly becomes visible due to alpha fading. It is counted off starting from the minimum visibility distance. It is counted off starting from the minimum visibility distance.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Minimum fade-in distance.

Ptr<Body> getBody ()

Returns a physical body assigned to the object.

Return value

Body assigned to the object or NULL (0), if no body is assigned.

int getIntersection (const Math::vec3 & p0, const Math::vec3 & p1, const Ptr<ObjectIntersection> & v, int surface)

Returns a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • const Math::vec3 & p0 - ID number of the surface.
  • const Math::vec3 & p1 - End point coordinates.
  • const Ptr<ObjectIntersection> & v - Variable used to control which type of intersection object will be returned:
  • int surface - Surface number.

Return value

Surface intersection flag.

void setCollision (int enabled, int surface)

Sets a surface collision flag. This flag indicates if collisions with a given surface are enabled.

Arguments

  • int enabled - Surface collision flag.
  • int surface - Surface number.

Ptr<Property> getPropertyInherit (int surface)

Inherits the property for the specific object. All transformations done to the inherited property will not affect the reference one.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Inherited property smart pointer.

void setMaxParent (int parent, int surface)

Sets a surface maximum LOD parent surface number.

Arguments

  • int parent - Surface maximum LOD parent surface number.
  • int surface - Surface number in range from 0 to number of surfaces.

void setPropertyState (const char * name, int state, int surface)

Sets a state value for a given surface property.

Arguments

  • const char * name - Property state name.
  • int state - State value.
  • int surface - ID number of the surface.

int getIntersection (const Math::vec3 & p0, const Math::vec3 & p1, int mask, const Ptr<ObjectIntersectionNormal> & v, int * ret_surface)

Returns a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • const Math::vec3 & p0 - ID number of the surface.
  • const Math::vec3 & p1 - End point coordinates.
  • int mask - Variable used to control which type of intersection object will be returned:
  • const Ptr<ObjectIntersectionNormal> & v - Surface number.
  • int * ret_surface

Return value

Surface intersection flag.

int getCastShadow (int surface)

Returns a surface cast shadow flag, which indicates if a given object surface should cast shadows from non-world lights.

Arguments

  • int surface - Surface number.

Return value

Surface cast shadow flag.

Ptr<Material> getMaterialInherit (int surface)

Inherits the surface material (i.e. creates a material instance). Modifications made in a new material instance will not affect the source material.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Inherited material smart pointer.

int setMaterial (const char * name, int surface)

Sets a material for a specified surface.

Arguments

  • const char * name - Name of the new material.
  • int surface - Surface number in range from 0 to number of surfaces.

Return value

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

Ptr<Material> getMaterial (int surface)

Returns the material smart pointer.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Material smart pointer.

void setMinParent (int parent, int surface)

Sets surface minimum LOD parent surface number.

Arguments

  • int parent - Surface minimum LOD parent surface number.
  • int surface - Surface number in range from 0 to number of surfaces.

Ptr<BodyRigid> getBodyRigid ()

Returns a rigid body assigned to the object.

Return value

Rigid body assigned to the object or NULL (0), if no body is assigned or the body is not rigid.

int getIntersectionMask (int surface)

Return an intersection mask for a given surface.

Arguments

  • int surface - Surface number.

Return value

Surface intersection mask.

int getViewportMask (int surface)

Returns a viewport mask for a given surface. The object surface is rendered, if its mask matches the player (camera), light source and material masks.

Arguments

  • int surface - Surface number.

Return value

Surface viewport mask.

int setProperty (const char * name, int surface)

Sets a property for a given surface.

Arguments

  • const char * name - Name of the new property.
  • int surface - Surface number in range from 0 to number of surfaces.

Return value

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

int getIntersection (const Math::vec3 & p0, const Math::vec3 & p1, int mask, const Ptr<ObjectIntersectionTexCoord> & v, int * ret_surface)

Returns a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • const Math::vec3 & p0 - ID number of the surface.
  • const Math::vec3 & p1 - End point coordinates.
  • int mask - Variable used to control which type of intersection object will be returned:
  • const Ptr<ObjectIntersectionTexCoord> & v - Surface number.
  • int * ret_surface

Return value

Surface intersection flag.

int setMaterial (const char * name, const char * pattern)

Sets a material for a specified surface.

Arguments

  • const char * name - Name of the new material.
  • const char * pattern - Surface number in range from 0 to number of surfaces.

Return value

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

void setEnabled (int enabled)

Enables or disables the node.

Arguments

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

int getNumSurfaces ()

Returns the number of object surfaces.

Return value

Number of surfaces of the object.

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.

const char * getPropertyName (int surface)

Returns the name of a property applied to a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Name of the surface property.

void setMinFadeDistance (float distance, int surface)

Updates minimum fade-in distance of a given surface. Across this distance the surface smoothly becomes visible due to alpha fading. It is counted off starting from the minimum visibility distance.

Arguments

  • float distance - Minimum fade-in distance. The default is 0.
  • int surface - Surface number in range from 0 to number of surfaces.

void setEnabled (int enabled, int surface)

Enables or disables the node.

Arguments

  • int enabled - 1 to enable the surface, 0 to disable it.
  • int surface - Surface number.

BoundBox getBoundBox (int surface)

Returns the bounding box of a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Bounding box.

const char * getSurfaceName (int surface)

Returns the name of a given object surface.

Arguments

  • int surface - number of the surface.

Return value

Surface name.

void setMinVisibleDistance (float distance, int surface)

Updates minimum visibility distance of a given surface (the distance, starting from which the surface begins fading in and then is completely visible).

Arguments

  • float distance - Minimum visibility distance. The default is -inf.
  • int surface - Surface number in range from 0 to number of surfaces.

int getIntersection (const Math::vec3 & p0, const Math::vec3 & p1, int mask, Math::vec3 * ret_point, Math::vec3 * ret_normal, Math::vec4 * ret_texcoord, int * ret_index, int * ret_surface)

Returns a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • const Math::vec3 & p0 - Coordinates of the line start point.
  • const Math::vec3 & p1 - Coordinates of the line end point.
  • int mask - Intersection mask.
  • Math::vec3 * ret_point - Intersection point of the line and object. You can pass NULL if the parameter is not required.
  • Math::vec3 * ret_normal - Normal vector to the intersection point. You can pass NULL if the parameter is not required.
  • Math::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). You can pass NULL if the parameter is not required.
  • int * ret_index - Intersected triangle number. You can pass NULL if the parameter is not required.
  • int * ret_surface - Intersected surface number. You can pass NULL if the parameter is not required.

Return value

Surface intersection flag.

int isMaterialInherited (int surface)

Returns a value indicating if a given surface material is inherited. Modifications made in a material instance do not affect the source material.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Returns 1 if the object surface material is inherited.

int getCollision (int surface)

Returns a surface collision flag. This flag indicates if collisions with a given surface are enabled.

Arguments

  • int surface - Surface number.

Return value

Surface collision flag.

int getIntersection (const Math::vec3 & p0, const Math::vec3 & p1, Math::vec3 * ret_point, Math::vec3 * ret_normal, Math::vec4 * ret_texcoord, int * ret_index, int surface)

Returns a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • const Math::vec3 & p0 - Coordinates of the line start point.
  • const Math::vec3 & p1 - Coordinates of the line end point.
  • Math::vec3 * ret_point - Intersection point of the line and object. You can pass NULL if the parameter is not required.
  • Math::vec3 * ret_normal - Normal vector to the intersection point. You can pass NULL if the parameter is not required.
  • Math::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). You can pass NULL if the parameter is not required.
  • int * ret_index - Intersected triangle number. You can pass NULL if the parameter is not required.
  • int surface - The number of the surface, with which the intersection must be detected.

Return value

Surface intersection flag.

float getMaxVisibleDistance (int surface)

Returns maximum visibility distance of a given surface (the distance, from which the surface begins fading out until completely invisible).

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Maximum visibility distance of the surface.
Last update: 2017-07-03