Contents, Programmers Guide, Applying the SDK, Pathfinding Queries
Pathfinding Queries
Supplying a context
Each query accepts a collision context argument.
This controls the set of obstacles to be 'included' for the query.
Calling against the mesh or agent interfaces
In general, each query can be invoked on either the
Interface iMesh
or the
Interface iAgent
interface.
The iAgent methods supply
arguments corresponding to the position and shape
of the agent on which the method is called,
and ensure that the agent itself is not treated as an obstruction.
Preprocess requirements
Connectivity queries require the generation of pathfind preprocess, with
iMesh::generatePathfindPreprocessFor().
The queries
Shortest path
iMesh::findShortestPath()
and
iAgent::findShortestPathTo()
provide the fundamental pathfinding query for a path from a known start point to a known goal.
iMesh::findShortestPath_WithQueryCallBack()
and
iAgent::findShortestPathTo_WithQueryCallBack()
extend this with the possibility to restrict pathfinding scope or number of iterations.
(See Limiting the Scope for Pathfinding and Aborting Pathfinding Early)
iMesh::findShortestPath_MultipleStartPositions()
searches for the shortest path where multiple potential start positions could be used
(e.g. multiple agents could potentially be selected to attack a single target).
Note that this shortest path query version can then also be used for implementing search to multiple targets,
in cases where paths are reversible, by calling
iMesh::reversePath()
to reverse the path result.
Path away
iMesh::findPathAway()
and
iAgent::findPathAway()
both find the shortest path out of a region around a specified point.
This can be used as the basis for a 'run away' behaviour.
iMesh::findPathAway_WithQueryCallBack()
and
iAgent::findPathAway_WithQueryCallBack()
extend this with the possibility to restrict pathfinding scope or number of iterations.
(See Limiting the Scope for Pathfinding and Aborting Pathfinding Early)