This page has been translated automatically.
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
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Navigation Mesh

A navigation mesh is a navigation area which is arranged above the surface of the arbitrary mesh. In fact, the navigation mesh is the area of the specified height above the mesh polygons, which is available for pathfinding.

In contrast to navigation sectors, the navigation mesh enables the following:

  • Only 2D routes can be calculated within the navigation mesh.
  • Pathfinding can be performed within 1 navigation mesh only. Pathfinding within the following areas is not supported:
    • Within several intersecting navigation meshes.
    • Within the intersecting navigation mesh and sector.

See also

  • The NavigationMesh class to edit navigation meshes via UnigineScript
  • The article on Creating Routes to learn how to create routes inside the navigation mesh
  • A set of samples located in the data/samples/paths folder:
    1. mesh_00
    2. route_03
    3. route_04

Creating Navigation Mesh

Before adding a navigation mesh, you should prepare a mesh, on which this navigation mesh will be based. Such mesh is created separately and should meet the following requirements:

  • Any polygon of the mesh must not share its edge with more than 2 other polygons; otherwise, an error will occur.
  • Mesh polygons should be as wide as possible (ideally, they should be equilateral). Too narrow and high polygons may reduce accuracy of path calculation.
  • The mesh should be optimized: it should not contain a large number of polygons.

When a mesh is prepared, you can add the navigation mesh to the scene via UnigineEditor:

  1. Run UnigineEditor.
  2. On the Menu bar, click Create -> Path -> Navigation Mesh.

  3. In the file dialog window that opens, choose the required mesh to be used as a base for the new navigation area and click Ok.

  4. Click somewhere in the world to place the navigation mesh. The new navigation mesh will be added to UnigineEditor and you will be able to edit it via the Nodes panel.

Notice
The created navigation mesh only provides an area within which the 2D routes are calculated. The routes themselves should be created from the script.

Example

If you have a scene with different objects and you need to calculate a 2D route among them, you will need to add the navigation mesh to this scene as follows:

  1. Create a flat mesh with holes in places where the objects are positioned.
    The scene
    The mesh created for the navigation mesh
  2. Specify this mesh as a base for a navigation mesh within which the route will be calculated and add the navigation mesh to the world. It will be highlighted in green:

    A navigation mesh based on the flat mesh
  3. Place the navigation mesh above the scene.

    The navigation mesh positioned above the scene

Notice
In this case, you can also use a navigation sector with obstacles positioned inside it instead of the navigation mesh. However, the navigation mesh is preferred for more complex cases.

Editing Navigation Mesh

On the Navigation tab of the Nodes panel, you can adjust the following parameters of the navigation mesh:

Navigation Navigation mask. The navigation mask of the navigation mesh must match the navigation mask of the route that is calculated within it. Otherwise, the navigation mesh will not participate in pathfinding.
Quality Quality of optimization of the route that has already been calculated. This value specifies the number of iterations that are used for taking the short cut. The higher the value, the longer the route calculation will take.
Velocity Scaling factor for velocity of the point that moves inside the navigation mesh.
Dangerous Danger factor that indicates if the moving point should try to avoid the navigation mesh.
Notice
If the danger factor exceeds the maximum danger factor set for the route, the navigation mesh will be excluded from pathfinding calculations.
Depth Depth value. This value affects the quality of the route that is currently calculated. The larger the depth value, the better control over accuracy and speed of route calculation is provided. The depth can take integer value in range [0;4]. By default, the depth is set to 0 for a new navigation mesh. The 2, 3, 4 values are used for deeper heuristics.
Height Distance above the mesh polygons available for pathfinding. By default, the height is set to 1 for a new navigation mesh.

Loading a New Mesh

To load a new mesh on which the navigation area will be based:

  1. On the Navigation tab, press .
  2. In the file dialog window that opens, choose the required mesh and press Ok.

Saving the Current Mesh

To save the current mesh on which the navigation area is based:

  1. On the Navigation tab, press .
  2. In the file dialog window that opens, specify a name for the mesh and press Ok.
Last update: 03.07.2017
Build: ()