PathEngine home previous: iMesh::findPathAway()next: iMesh::findShortestPath()
Contents, API Reference, Interfaces, iMesh, findPathAway_WithQueryCallBack

iMesh::findPathAway_WithQueryCallBack()

Description

Finds the shortest path of escape from a specified region from a given start position.
(This version supports passing in a callback object to enable the query to be aborted early.)

Syntax

iPath* findPathAway_WithQueryCallBack(iShape* shape, const iCollisionContext* context, const cPosition& start, const cPosition& awayFrom, tSigned32 distanceAway, 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.
awayFrom A position defining the centre of a region to escape from. This position must be a valid position on this mesh.
distanceAway Controls the size of the region to escape from, see below.
Must be greater than zero.
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

The distance applies as a manhattan distance along the x and y axes.
In other words the query searches for a position to satisfy the following:

x >= awayFrom.x - distanceAway
x <= awayFrom.x + distanceAway
y >= awayFrom.y - distanceAway
y <= awayFrom.y + distanceAway

These bounds are applied with a kind of 'flood fill' mechanism, with potential goal positions generated only where the bounds are reachable through the ground mesh.
(See The path away query for further explanation of this mechanism, with screen shots.)

If no unobstructed path to such a point exists then an empty path is returned. If 'start' already satisfies the distance constraint then a path with only one point is returned.

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 satisfy the distance constraint.

See Also

iMesh::findPathAway(), iMesh::findShortestPath(), iMesh::findShortestPath_WithQueryCallBack(), Interface iCollisionContext
Documentation for PathEngine release 5.17 - Copyright © 2002-2008 PathEnginenext: iMesh::findShortestPath()