This page has been translated automatically.
Programming
Fundamentals
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
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
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.

Object Class

Inherits:Node

An object with a set of surfaces to represent geometry. Rendering materials are assigned per object surface. An object can be assigned a physical body.

Object Class

Members


Object cast(Node node)

Arguments

  • Node node

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.

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.

BoundBox getBoundBox(int surface)

Returns a bounding box of a given surface.

Arguments

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

Return value

Bounding box.

BoundSphere getBoundSphere(int surface)

Returns a bounding sphere of a given surface.

Arguments

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

Return value

Bounding sphere.

void setCastShadow(int enabled, int surface)

Sets a value indicating if a given surface should cast shadows from non-world lights.

Arguments

  • int enabled - Positive number to let the surface cast shadows, 0 no to let.
  • int surface - ID number of the surface.

int getCastShadow(int surface)

Returns a value indicating if a given surface casts shadows from non-world lights.

Arguments

  • int surface - ID number of the surface.

Return value

Positive number if shadows are cast by the surface.

void setCastWorldShadow(int enabled, int surface)

Sets a value indicating if a given surface should cast shadows from world lights.

Arguments

  • int enabled - Positive number to let the surface cast world shadows, 0 no to let.
  • int surface - ID number of the surface.

int getCastWorldShadow(int surface)

Returns a value indicating if a given surface casts shadows from world lights.

Arguments

  • int surface - ID number of the surface.

Return value

Positive number if world shadows are cast by the surface.

void setCollision(int enabled, int surface)

Enables or disables collisions with a given surface.

Arguments

  • int enabled - Positive number to enable collisions with the surface; otherwise 0.
  • int surface - ID number of the surface.

int getCollision(int surface)

Returns a value indicating if collisions with a given surface are calculated.

Arguments

  • int surface - ID number of the surface.

Return value

Positive number if collisions with the surface are calculated; otherwise 0.

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 - Integer, each bit of which is a mask.
  • int surface - ID number of the surface.

int getCollisionMask(int surface)

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

Arguments

  • int surface - ID number of the surface.

Return value

Integer, each bit of which is a mask.

void setEnabled(int enabled)

Enables or disables a given surface.

Arguments

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

void setEnabled(int enabled, int surface)

Enables or disables a given surface.

Arguments

  • int enabled - Positive number to enable the surface, 0 to disable it.
  • int surface - ID number of the surface.

int isEnabled(int surface)

Returns a value indicating if a given surface is enabled.

Arguments

  • int surface - ID number of the surface.

Return value

Positive number if the surface is enabled; otherwise, 0.

int isEnabled()

Returns a value indicating if a given surface is enabled.

Return value

Positive number if the surface is enabled; otherwise, 0.

void setFolded(int folded, int surface)

Shows or minimizes surface's children in the surface hierarchy.

Arguments

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

int isFolded(int surface)

Returns a value indicating if surface's children are displayed or minimized in the surface hierarchy.

Arguments

  • int surface - Surface ID to minimize its children.

Return value

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

void setIntersection(int enabled, int surface)

Enables or disables intersections with a given surface.

Arguments

  • int enabled - Positive number to enable intersections with the surface; otherwise 0.
  • int surface - ID number of the surface.

int getIntersection(vec3 p0, vec3 p1, ObjectIntersectionTexCoord v, int surface)

Returns a value indicating if a given surface can be intersected.

Arguments

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

Return value

Positive number if the surface can be intersected; otherwise 0.

int getIntersection(int surface)

Returns a value indicating if a given surface can be intersected.

Arguments

  • int surface - ID number of the surface.

Return value

Positive number if the surface can be intersected; otherwise 0.

int getIntersection(vec3 p0, vec3 p1, ObjectIntersectionNormal v, int surface)

Returns a value indicating if a given surface can be intersected.

Arguments

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

Return value

Positive number if the surface can be intersected; otherwise 0.

int getIntersection(vec3 p0, vec3 p1, int mask, ObjectIntersection v, int * ret_surface)

Returns a value indicating if a given surface can be intersected.

Arguments

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

Return value

Positive number if the surface can be intersected; otherwise 0.

int getIntersection(vec3 p0, vec3 p1, ObjectIntersection v, int surface)

Returns a value indicating if a given surface can be intersected.

Arguments

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

Return value

Positive number if the surface can be intersected; otherwise 0.

int getIntersection(vec3 p0, vec3 p1, int mask, ObjectIntersectionNormal v, int * ret_surface)

Returns a value indicating if a given surface can be intersected.

Arguments

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

Return value

Positive number if the surface can be intersected; otherwise 0.

int getIntersection(vec3 p0, vec3 p1, int mask, ObjectIntersectionTexCoord v, int * ret_surface)

Returns a value indicating if a given surface can be intersected.

Arguments

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

Return value

Positive number if the surface can be intersected; otherwise 0.

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

Returns a value indicating if a given surface can be intersected.

Arguments

  • vec3 p0 - ID number of the surface.
  • vec3 p1 - End point coordinates.
  • int mask - Variable used to control which type of intersection object will be returned:
  • vec3 * ret_point - Surface number.
  • vec3 * ret_normal - Normal vector to the intersection point. You can pass NULL if the parameter is not required.
  • 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

Positive number if the surface can be intersected; otherwise 0.

int getIntersection(vec3 p0, vec3 p1, vec3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int surface)

Returns a value indicating if a given surface can be intersected.

Arguments

  • vec3 p0 - ID number of the surface.
  • vec3 p1 - End point coordinates.
  • vec3 * ret_point - Variable used to control which type of intersection object will be returned:
  • vec3 * ret_normal - Surface number.
  • 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

Positive number if the surface can be intersected; otherwise 0.

void setIntersectionMask(int mask, int surface)

Sets an intersection mask for a given surface.

Arguments

  • int mask - Integer, each bit of which is a mask.
  • int surface - ID number of the surface.

int getIntersectionMask(int surface)

Returns an intersection mask of a given surface.

Arguments

  • int surface - ID number of the surface.

Return value

Integer, each bit of which is a mask.

void setLightMask(int mask, int surface)

Sets a light mask for a given surface. A surface is illuminated by a light source, if they both have corresponding masks.

Arguments

  • int mask - Integer, each bit of which is a mask.
  • int surface - ID number of the surface.

int getLightMask(int surface)

Returns a light mask of a given surface. A surface is illuminated by a light source, if they both have corresponding masks.

Arguments

  • int surface - ID number of the surface.

Return value

Integer, each bit of which is a mask.

int setMaterial(string name, variable surface)

Sets a material for a specified surface.

Arguments

  • string name - Name of the new material.
  • variable surface - ID number of the surface (int) or pattern (string with a regular expression), against which surface names will be matched.

Return value

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

Material getMaterial(int surface)

Returns a material used for a given surface.

Arguments

  • int surface - ID number of the surface.

Return value

Material used for the surface.

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 - ID number of the surface.

Return value

The inherited material.

int isMaterialInherited(int surface)

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

Arguments

  • int surface - ID number of the surface.

Return value

Positive number if the material is inherited; otherwise, 0.

string getMaterialName(int surface)

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

Arguments

  • int surface - ID number of the surface.

Return value

Material name.

void setMaterialParameter(string name, vec4 parameter, int surface)

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

Arguments

  • string name - Name of the parameter.
  • vec4 parameter - Value of the parameter.
  • int surface - ID number of the surface.

vec4 getMaterialParameter(string name, int surface)

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

Arguments

  • string name - Name of the parameter.
  • int surface - ID number of the surface.

Return value

Value of the parameter.

void setMaterialState(string name, int state, int surface)

Sets a state value for a given surface material.

Arguments

  • string name - Material state name.
  • int state - State value.
  • int surface - ID number of the surface.

int getMaterialState(string name, int surface)

Returns a state value of a given surface material.

Arguments

  • string name - Material state name.
  • int surface - ID number of the surface.

Return value

State value.

void setMaterialTexture(string name, string texture, int surface)

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

Arguments

  • string name - Material texture name.
  • string texture - Path to the texture file.
  • int surface - ID number of the surface.

string getMaterialTexture(string name, int surface)

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

Arguments

  • string name - Material texture name.
  • int surface - ID number of the surface.

Return value

Path to the texture file.

void setMaxFadeDistance(float distance, int surface)

Updates a maximum fade-out distance, across which the surface smoothly becomes invisible due to the alpha fading. It is counted starting from the maximum visibility distance value.

Arguments

  • float distance - A minimum fade-out distance, in units. If a negative value is provided, 0 will be used instead.
  • int surface - ID number of the surface.

float getMaxFadeDistance(int surface)

Returns a maximum fade-out distance, across which the surface smoothly becomes invisible due to the alpha fading. It is counted starting from the maximum visibility distance value.

Arguments

  • int surface - ID number of the surface.

Return value

Distance value, in units.

void setMaxParent(int parent, int surface)

Updates the number of hierarchy levels up to the reference object, which is used to measure the maximum visible distance:
  • 0 is the current surface
  • 1 is the object to which the surface belongs
  • higher values are to move higher up the hierarchy to node parents

Arguments

  • int parent - Number of hierarchy levels. If a negative value is provided, 0 will be used instead.
  • int surface - ID number of the surface.

int getMaxParent(int surface)

Returns the number of hierarchy levels up to the reference object, which is used to measure the maximum visible distance:
  • 0 is the current surface
  • 1 is the object to which the surface belongs
  • higher values are to move higher up the hierarchy to node parents

Arguments

  • int surface - ID number of the surface.

Return value

Number of hierarchy levels.

void setMaxVisibleDistance(float distance, int surface)

Updates the maximum visibility distance, starting at which the surface begins to fade out until becomes completely invisible.

Arguments

  • float distance - A maximum visibility distance, in units. If a negative value is provided, 0 will be used instead.
  • int surface - ID number of the surface.

float getMaxVisibleDistance(int surface)

Returns a maximum visibility distance, starting at which the surface begins to fade out until becomes completely invisible.

Arguments

  • int surface - ID number of the surface.

Return value

Distance value, in units.

void setMinFadeDistance(float distance, int surface)

Updates a minimum fade-in distance, across which the surface smoothly becomes visible due to the alpha fading. It is counted starting from the minimum visibility distance value.

Arguments

  • float distance - A minimum fade-in distance, in units. If a negative value is provided, 0 will be used instead.
  • int surface - ID number of the surface.

float getMinFadeDistance(int surface)

Returns a minimum fade-in distance, across which the surface smoothly becomes visible due to the alpha fading. It is counted starting from the minimum visibility distance value.

Arguments

  • int surface - ID number of the surface.

Return value

Distance value, in units.

void setMinParent(int parent, int surface)

Updates the number of hierarchy levels up to the reference object, which is used to measure the minimum visible distance:
  • 0 is the current surface
  • 1 is the object to which the surface belongs
  • higher values are to move higher up the hierarchy to node parents

Arguments

  • int parent - Number of hierarchy levels. If a negative value is provided, 0 will be used instead.
  • int surface - ID number of the surface.

int getMinParent(int surface)

Returns the number of hierarchy levels up to the reference object, which is used to measure the minimum visible distance:
  • 0 is the current surface
  • 1 is the object to which the surface belongs
  • higher values are to move higher up the hierarchy to node parents

Arguments

  • int surface - ID number of the surface.

Return value

Number of hierarchy levels.

void setMinVisibleDistance(float distance, int surface)

Updates a minimum visibility distance, starting at which the surface begins to fade in and then becomes completely visible.

Arguments

  • float distance - A minimum visibility distance, in units. If a negative value is provided, 0 will be used instead.
  • int surface - ID number of the surface.

float getMinVisibleDistance(int surface)

Returns a minimum visibility distance, starting at which the surface begins to fade in and then becomes completely visible.

Arguments

  • int surface - ID number of the surface.

Return value

Distance value, in units.

int getNumSurfaces()

Returns the number of surfaces of the object.

Return value

Number of surfaces.

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.

Object getObject()

Returns an object pointer.

Return value

Object pointer.

void setParent(int parent, int surface)

Sets or clears the parent surface of a given surface.

Arguments

  • int parent - ID number of the parent surface or -1 to clear the parent.
  • int surface - ID number of the surface.

int getParent(int surface)

Returns the parent surface of a given surface.

Arguments

  • int surface - ID number of the surface.

Return value

ID number of the parent surface.

int setProperty(string name, variable surface)

Sets a property for a given surface.

Arguments

  • string name - Name of the new property.
  • variable surface - ID number of the surface (int) or pattern (string with a regular expression), against which surface names will be matched.

Return value

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

Property getProperty(int surface)

Returns a property defined for a given surface.

Arguments

  • int surface - ID number of the surface.

Return value

Property used for the surface.

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 - ID number of the surface.

Return value

The inherited property.

int isPropertyInherited(int surface)

Returns a value indicating if a given property is inherited.

Arguments

  • int surface - ID number of the surface.

Return value

Positive number if the property is inherited; otherwise, 0.

string getPropertyName(int surface)

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

Arguments

  • int surface - ID number of the surface.

Return value

Property name.

void setPropertyState(string name, int state, int surface)

Sets a state value for a given surface property.

Arguments

  • string name - Property state name.
  • int state - State value.
  • int surface - ID number of the surface.

int getPropertyState(string name, int surface)

Returns a state value of a given surface property.

Arguments

  • string name - Material state name.
  • int surface - ID number of the surface.

Return value

State value.

string getSurfaceName(int surface)

Returns the name of a given surface.

Arguments

  • int surface - ID number of the surface.

Return value

Name of the surface.

void setViewportMask(int mask, int surface)

Sets a bit mask for rendering into the viewport. The object surface is rendered, if its mask matches the player's and light source's ones. The material mask should also match.

Arguments

  • int mask - Integer, each bit of which is a mask.
  • int surface - ID number of the surface.

int getViewportMask(int surface)

Returns the current bit mask for rendering into the viewport. The object surface is rendered, if its mask matches the player's and light source's ones. The material mask should also match.

Arguments

  • int surface - ID number of the surface.

Return value

Integer, each bit of which is a mask.

WorldBoundBox getWorldBoundBox(int surface)

Returns the world bounding box of a given surface.

Arguments

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

Return value

Bounding box.

WorldBoundSphere getWorldBoundSphere(int surface)

Returns the world bounding sphere of a given surface.

Arguments

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

Return value

Bounding sphere.

int findSurface(string name)

Searches for a surface with a given name.

Arguments

  • string name - Name of the surface.

Return value

Surface ID number or -1, if nothing is found.

void flushBodyTransform()

Forces to set the transformations of the body for the node.
Last update: 2017-07-03
Build: ()