This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

Unigine.PathRoute Class

This class calculates the shortest 2D or 3D route around the obstacles within connected navigation areas and sets the size and velocity of the point moving along this route.

  • In case of 2D route, a point moves in the lower plane of the navigation area. The Z coordinate is not taken into account when calculating the 2D route. The height and radius values set for the point via the setHeight() and setRadius() functions are used to check whether the navigation area can take part in pathfinding: if the height or radius set for the point is greater than the size of the navigation area, such navigation area will be discarded. If the height difference between the connected areas exceeds the maximum height, the navigation area is also discarded from calculations.
  • In case of 3D route (available only for navigation sectors), a point moves in 3 dimensions. The radius set for the point via the setRadius() function is used to check whether the navigation sector can take part in pathfinding: if the radius set for the point is greater than the size of the navigation sector, it will be discarded. Also the point cannot rise up higher than the maximum height set for the navigation sector.

Functions of the PathRoute class enable to ignore the specified navigation areas and obstacles. Also the maximum time acceptable to get to the destination point and the maximum danger factor can be limited as well.

Notice
To choose between navigation areas, A* algorithm is used.
Warning
  • There is no connection between functions of the PathRoute class and functions of the Path class.
  • 3D navigation feature is experimental and not recommended for production use.

See Also
#

  • The Creating Routes usage example demonstrating how to create routes and recalculate them considering obstacles
  • Navigation sample in C# Component Samples suite
  • A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/paths/ folder

PathRoute Class

Properties

float Velocity#

The current velocity of the point moving along the route.

float Radius#

The current radius that is required to move the point along the route inside the navigation area.

int ObstacleMask#

The current obstacle mask. the obstacle is taken into account if its obstacle mask matches the obstacle mask of the route.

int NumPoints#

The number of turning points along the route.

int NavigationMask#

The current navigation mask. the navigation mask of the navigation area must match the navigation mask of the route that is calculated within it. Otherwise, the area will not participate in pathfinding.

float MaxTime#

The current maximum time for reaching the destination point. if the route takes longer, the point will not move along it.

float MaxHeight#

The current maximum height difference between the connected navigation areas acceptable when finding the 2d route. in case of the 3d route, it is the maximum height the point can move up to.

float MaxDangerous#

The maximum danger factor acceptable for moving along this route. if the navigation areas have a higher danger factor, the point will not move along it.

float MaxAngle#

The Cosine of the maximum possible angle between navigation mesh polygons. for example, this option enables to exclude walls when calculating a valid route.

float Height#

The current height that is required to move the point along the 2d route inside the navigation area.

bool IsReady#

The A value indicating that a route is calculated.

bool IsReached#

The A value indicating that a destination point of the route is reached.

bool IsQueued#

The A value indicating that a route is queued to be calculated.

float Time#

The time that is required for the point to move along the route.

float Distance#

The length of the route.

float Dangerous#

The highest danger factor of the navigation areas met along the route.

Members


PathRoute ( float radius = 0.0f ) #

Constructor. Creates a new 2D or 3D route. The radius is used to check whether the point can move inside a navigation area or this navigation area should be excluded from pathfinding.

Arguments

  • float radius - Radius of the point moving along the route.

void SetExcludeNavigations ( Node[] exclude_navigations ) #

Sets the list of navigation sectors and navigation meshes to be ignored during pathfinding.

Arguments

  • Node[] exclude_navigations - Array of the ignored navigation areas.

Node[] GetExcludeNavigations ( ) #

Returns the list of navigation sectors and navigation meshes excluded from pathfinding.

Arguments

    Return value

    Container to store the result.

    void SetExcludeObstacles ( Node[] obstacles ) #

    Sets the list of obstacles to be ignored during pathfinding.

    Arguments

    • Node[] obstacles - Array of the ignored obstacles.

    Node[] GetExcludeObstacles ( ) #

    Returns the list of obstacles ignored during pathfinding.

    Return value

    Container for obstacles.

    Obstacle GetIntersection ( PathRouteIntersection intersection ) #

    Returns the first intersected obstacle.

    Arguments

    Return value

    Intersected obstacle.

    Navigation GetNavigation ( int num ) #

    Returns the navigation sector or mesh within which the specified route point is located.

    Arguments

    • int num - Point number.

    Return value

    Navigation sector or navigation mesh.

    Obstacle GetObstacle ( int num ) #

    Returns the obstacle around which the route is turning.

    Arguments

    • int num - Point number.

    Return value

    Obstacle.

    vec3 GetPoint ( int num ) #

    Returns the coordinates of the turning point in the route.

    Arguments

    • int num - Point number.

    Return value

    Point coordinates.

    void AddExcludeNavigation ( Node navigation ) #

    Sets a navigation sector or a navigation mesh to be ignored during pathfinding. Excluded sectors/meshes are added into the list.

    Arguments

    • Node navigation - A navigation area to be ignored.

    void AddExcludeObstacle ( Node obstacle ) #

    Sets an obstacle to be ignored during pathfinding. Excluded obstacles are added into the list.

    Arguments

    • Node obstacle - An obstacle to be ignored.

    void Create2D ( vec3 p0, vec3 p1, int delay = 0 ) #

    Calculates a 2D route between the given points with the specified delay.

    Arguments

    • vec3 p0 - The starting point.
    • vec3 p1 - The destination point.
    • int delay - The number of frames which is possible to delay pathfinding calculations. 0 means the pathfinding should be calculated immediately.

    void Create3D ( vec3 p0, vec3 p1, int delay = 0 ) #

    Calculates a 3D route between the given points with the specified delay.

    Arguments

    • vec3 p0 - The starting point.
    • vec3 p1 - The destination point.
    • int delay - The number of frames which is possible to delay pathfinding calculations. 0 means the pathfinding should be calculated immediately.

    void RemoveExcludeNavigation ( Node navigation ) #

    Removes a navigation sector or a navigation mesh from the list of ignored ones during pathfinding.

    Arguments

    • Node navigation - A navigation area.

    void RemoveExcludeObstacle ( Node obstacle ) #

    Removes an obstacle from the list of ignored ones during pathfinding.

    Arguments

    • Node obstacle - An obstacle.

    void RenderVisualizer ( vec4 color ) #

    Renders the route in a given color.
    Notice
    You should enable the engine visualizer by the show_visualizer 1 console command.

    Arguments

    • vec4 color - Route color.
    Last update: 19.04.2024
    Build: ()