PathEngine home previous: Adding pathfind preprocessnext: The shortest path query
Contents, Programmers Guide, Example Projects, Tutorials, Tutorial 3, Path objects

Path objects

Interface iPath objects simply represent a sequence of connected positions on a mesh.

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.04 - Copyright © 2002-2024 PathEnginenext: The shortest path query