PathEngine home previous: iMesh::findShortestPath6()next: iMesh::findShortestPath_WithQueryCallBack()
Contents, API Reference, Interfaces, iMesh, findShortestPath_MultipleStartPositions



Finds the shortest path from a given set of start positions to a given end position for agents with a specified collision shape.


iPath* findShortestPath_MultipleStartPositions(const iShape* shape, const iCollisionContext* context, cPosition const * startPositions_Buffer, uint32_t startPositions_BufferEntries, const cPosition& goal, iQueryCallBack* queryCallBack) const;


shape The collision shape to use for this query.
context The state of dynamic collision that will apply for this query.
An empty context can be specified by passing a value of zero for this argument.
startPositions_Buffer, startPositions_BufferEntries (See Passing Arrays.) The start positions for pathfinding.
goal The target point for pathfinding.
This position must be a valid position on this mesh.
queryCallBack A pointer to a valid implementation of the iQueryCallBack interface, or else null.


Requires that pathfind preprocess has been generated on this mesh for the collision shape specified.

Return Value

A newly created Interface iPath object, if a path can be found.
Otherwise a zero pointer is returned.


This pathfinding query searches for the shortest path to the specified end position from any of the the array of positions passed in.

This may be used, for example, to find the shortest path from a group of agents to a specified target.

In certain situations where pathfinding constraints are symmetrical (e.g. no directional costs to traverse or one-way off mesh connections) this can then also be used for 'reverse' pathfinding to find the shortest path from a single agent to a set of potential target positions (see iMesh::reversePath()).

Queries for which the target position is obstructed can be alot more expensive, so if the target position is potentially obstructed then it is a good idea to call iMesh::testPointCollision() for the target position first.
If the target position is obstructed then you know that the query will fail.
This check is not performed internally to avoid adding overhead in cases where the target position is known in advance to be unobstructed.

Refer to Aborting Pathfinding Early for details about using the query callback mechanism.
Note that if the search is aborted by the query callback then the path returned will not reach the goal.

See Also

iMesh::findShortestPath(), iMesh::findShortestPath_WithQueryCallBack(), iMesh::findPathAway(), iMesh::findPathAway_WithQueryCallBack(), Interface iCollisionContext

C# Mapping

Path findShortestPath_MultipleStartPositions(Shape shape, CollisionContext context, PathEngine.Position[] startPositions, PathEngine.Position goal, QueryCallBack queryCallBack);

Java Mapping

Path findShortestPath_MultipleStartPositions(Shape shape, CollisionContext context, Position[] startPositions, Position goal, QueryCallBack queryCallBack);

Documentation for PathEngine release 6.00 - Copyright © 2002-2016 PathEnginenext: iMesh::findShortestPath_WithQueryCallBack()