Path
Introducing Path
The Path class is designed to work with paths in space.
In general, objects of this type are used by agents (Nav3DAgent) when performing a path search. But you can also use Path to find the path for your own purposes.
Of course, working with Path objects is only possible after Nav3D has been initialized.
To find a path between points A and B, you must:
1) Get an object of type Path
by calling the Nav3DObstacleManager.PrefetchPath(Vector3 _PointA, Vector3 _PointB)
method. This method will only create an instance of Path
and register it with Nav3D, but no pathfinding will be performed.
2) On the created Path
object, call the method:
UpdatePath(
Vector3? _Start = null,
Vector3? _Goal = null,
int? _Timeout = null,
bool? _Smooth = null,
Action _OnSuccess = null,
Action<PathfindingError> _OnFail = null
)
Values of overloaded parameters:
Vector3? _Start
– starting point of the path. The parameter must be passed if you want to change the starting point of the path.Vector3? _Goal
– the end point of the path. The parameter must be passed if you want to change the end point of the path.int? _Timeout
– maximum path search time. In case the path search takes longer, the _OnFail callback will be executed if it is not null.bool? _Smooth = null
– whether it is necessary to smooth the found path.Action _OnSuccess
= null – callback that will be called after successful path findingAction _OnFail
is a callback that will be called if the path could not be found for any reason.