PathEngine home previous: iAgent::findClosestUnobstructedPosition()next: iAgent::findPathAway_WithQueryCallBack()
Contents, API Reference, Interfaces, iAgent, findPathAway

iAgent::findPathAway()

Description

Finds the shortest path of escape from a specified region for the agent.

Syntax

iPath* findPathAway(const iCollisionContext* context, const cPosition& awayFrom, int32_t distanceAway) const;

Parameters

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.
Note that the agent is not considered to obstruct itself even if included in this context.
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.

Requirements

Requires that the agent is moveable and that pathfinding preprocess has been generated on the agent's mesh for the agent's collision shape.

The start point for pathfinding (i.e. the agent's current position) must not be obstructed by the base mesh or burnt-in obstacles.

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

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.

See Also

iAgent::findPathAway_WithQueryCallBack()

C# Mapping

Path findPathAway(CollisionContext context, PathEngine.Position awayFrom, int distanceAway);

Java Mapping

Path findPathAway(CollisionContext context, Position awayFrom, int distanceAway);

Documentation for PathEngine release 6.00 - Copyright © 2002-2016 PathEnginenext: iAgent::findPathAway_WithQueryCallBack()