|PathEngine home||previous: ||next: |
Pathfinding queries, such as iAgent::findShortestPathTo() and
iAgent::findPathAway(), use iPath objects to return the result of the query.
You can think of the path as the movement required for an agent to solve the constraints of the query.
Note that a null pointer is returned from a failed query, and a path with just 1 position is returned when an agent does not need to move.
We add a variable for the agent's current path:
// the agents current path unique_ptr<iPath> path;
And the following code to draw the path:
// draw path if there is one testbed->setColour("green"); testbed->drawPath(path.get());
(Note that it is safe to call iTestBed::drawPath() with a null pointer. This will simply return with no effect.)
|Documentation for PathEngine release 6.03 - Copyright © 2002-2021 PathEngine||next: |