Nav3DObstacleManager

Nav3DObstacleManager

Nav3DObstacleManager has been implemented to work with obstacles. Its public methods are:

  • public static void AddObstacle(Transform _Obstacle, bool _FullTraversal = true, Action<ObstacleAdditionResult> _OnSuccess = null) – process (register) an obstacle.
  • public static void AddObstacleSet(List _Obstacles, bool _FullTraversal = true, Action<ObstacleAdditionResult> _OnSuccess = null) – process (register) the list of obstacles.
  • public static void RemoveObstacle(Transform _Obstacle, Action _OnSuccess = null) – remove an obstacle from the navigation graph.
  • public static void RemoveObstacleSet(List _ObstacleSet, Action _OnSuccess = null) – remove the list of obstacles from the navigation graph.
  • public static void UpdateObstacle(Transform _Obstacle, bool _FullTraversal = true, Action<ObstacleAdditionResult> _OnSuccess = null) – update the obstacle in the navigation graph.
  • public static void UpdateObstacleSet(List _ObstacleSet, bool _FullTraversal = true, Action<ObstacleAdditionResult> _OnSuccess = null) – update the list of obstacles in the navigation graph.
  • public static Path PrefetchPath(Vector3 _PointA, Vector3 _PointB) – get a Path object to find the path from _PointA to _PointB, see Path section for details

Explanation of the meaning of some general parameters:

  • bool _FullTraversal – whether it is necessary to apply the operation to the entire transform-hierarchy of the object, if not, then the operation will be applied only to the object itself (to the set of objects in the case of AddObstacleSet, RemoveObstacleSet and UpdateObstacleSet).
  • Action _OnSuccess<ObstacleAdditionResult> – action after successful completion of the operation. An argument of type ObstacleAdditionResult stores the time characteristics of the performed processing of the obstacle.
public struct ObstacleAdditionResult
{
    #region Properties

    //Total processing time for an obstacle.
    public TimeSpan TotalProcessingTime { get; private set; }

    //Octree building time.
    public TimeSpan OctreeBulidTime { get; private set; }

    //Navigation graph building time by octree.
    public TimeSpan GraphBuildTime { get; private set; }

    #endregion
}