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

std::unique_ptr<iPath> findPathAway_WithQueryCallBack(const iShape& shape, const iCollisionContext* context, const cPosition& start, const cPosition& awayFrom, int32_t 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 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.

Requirements

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.

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

C# Mapping

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 PathEnginenext: iMesh::findShortestPath()