Nav3DPath: Pathfinding
To perform pathfinding you need to do:
- Create a
Nav3DPath
instance using constructor new Nav3DPath(). - Call one of the following methods:
To search a path between 2 points:
public void Find(
Vector3 _Start,
Vector3 _End,
Action _OnSuccess = null,
Action _OnFail = null
)
Parameters meaning:
- Action _OnSuccess – successful pathfinding completion callback.
- Action<PathfindingError> _OnFail – pathfinding fail callback, contains some info about error.
To search a path between more than 2 points:
public void Find(
Vector3[] _Goals,
bool _Loop,
bool _SkipUnpassableGoals = false,
Action _OnSuccess = null,
Action _OnFail = null
)
Parameters meaning:
- bool _Loop – whether need to loop the path (if true then the end and start points will be connected by path as well).
- bool _SkipUnpassableGoals – whether skip any point pathfinding to which was failed. If true, then the failure to find a path between any pair of points will lead to pathfinding abort and _OnFail callback to be invoked.
It is possible to repeat the last pathfinding procedure. It can be useful in case when the scene configuration has changed and the last found path is no longer relevant.
To do this, call the public void Update()
method.