PathEngine home | previous: | next: |
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.)
std::unique_ptr<iPath> findPathAway_WithQueryCallBack(const iShape& shape, const iCollisionContext* context, const cPosition& start, const cPosition& awayFrom, int32_t distanceAway, 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 nullptr for this argument. | ||
start |
The start point for pathfinding. This position must be a valid position on this mesh, and must not be obstructed by the base mesh or burnt-in obstacles. | ||
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. |
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
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
Note that if the search is aborted by the query callback then the path returned will not satisfy the distance constraint.
Path findPathAway_WithQueryCallBack(Shape shape, CollisionContext context, PathEngine.Position start, PathEngine.Position awayFrom, int distanceAway, QueryCallBack queryCallBack); |
Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEngine | next: |