PathEngine home previous: iMesh::findShortestPath()next: iMesh::firstCollision()
Contents, API Reference, Interfaces, iMesh, findShortestPath_WithQueryCallBack

iMesh::findShortestPath_WithQueryCallBack()

Description

Finds the shortest path from a given start position to a given end position for agents with a specified collision shape.
(This version supports passing in a callback object to enable the query to be aborted early.)

Syntax

iPath* findShortestPath_WithQueryCallBack(iShape* shape, const iCollisionContext* context, const cPosition& start, const cPosition& goal, iQueryCallBack* queryCallBack) const;

Parameters

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.
start The start point for pathfinding. This position must be a valid position on this mesh.
This start point must be unobstructed.
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.

Requirements

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

Return Value

Always returns a newly created Interface iPath object.
If pathfinding fails then this path will be empty.

Remarks

If start and end are identical then a path with only one point is returned.

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::findPathAway(), iMesh::findPathAway_WithQueryCallBack(), Interface iCollisionContext
Documentation for PathEngine release 5.17 - Copyright © 2002-2008 PathEnginenext: iMesh::firstCollision()