UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials

Navigation Class

This class creates a navigation area within which path finding is performed: it can be either a navigation sector or a navigation mesh. It allows to scale the velocity of objects moving through it. If its danger factor exceeds the maximum danger factor for the path route, the navigation area will be excluded from path finding calculations.

Navigation Class

This class inherits from Node

Members


float getDangerous ()

Returns the current danger factor indicating if the moving object should try to avoid this navigation area.

Return value

Danger factor.

int getNavigationMask ()

Returns the current navigation mask. Only that navigation sectors and navigation meshes are taken into account, which have a matching mask.

Return value

Integer, each bit of which is a mask.

Navigation getNavigation (int num)

Returns the specified connected navigation area.

Arguments

  • int num - Navigation area number.

Return value

Navigation area.

int getNumNavigations ()

Returns the number of navigation areas that intersect the current one.

Return value

The number of connected navigation areas.

int getQuality ()

Returns the route optimization quality value.

Return value

Quality value. The default is 2.

float getVelocity ()

Returns the current scale for velocity of the object moving inside the navigation area.

Return value

Velocity scale.

int inside2D (vec3 point, float radius)

Checks whether the given point is inside the navigation area and is available for 2D path finding.

Arguments

  • vec3 point - Point coordinates.
  • float radius - The radius of the point to check.
    • This option is for checking intersections with NavigationMesh only. Otherwise, if the point is above the edge of two polygons that are positioned at an angle, zero will be returned. (It happens because the height of the mesh is calculated straight above the polygon). Setting the radius allows to avoid such situations.
    • When checking intersections with NavigationSector, this option is irrelevant.

Return value

1 if the point is inside the navigation area; otherwise, 0.

int inside3D (vec3 point, float radius)

Checks whether the given point is inside the navigation area and is available for 3D path finding.

Arguments

  • vec3 point - Point coordinates.
  • float radius - The radius of the point to check.

Return value

1 it the point is inside the navigation area; otherwise, 0.

void setDangerous (float dangerous)

Sets the danger factor indicating if the moving object should try to avoid this navigation area. The default is 0.

Arguments

  • float dangerous - Danger factor.

void setNavigationMask (int mask)

Sets the navigation mask. Only that navigation sectors and navigation meshes are taken into account, which have a matching mask. The default is 1.

Arguments

  • int mask - Integer, each bit of which is a mask.

void setQuality (int q)

Sets the route optimization quality value. The default is 2.

Arguments

  • int q - Quality value. If a negative value is provided, 0 will be used instead.

void setVelocity (float velocity)

Sets the scale for velocity of the object moving inside the navigation area. The default is 1.

Arguments

  • float velocity - Velocity scale.
Last update: 2017-07-03