PathEngine home previous: 'LoadPathEngine'next: 'Swarm'
Contents, Programmers Guide, Example Projects, Other Examples, 'TestApplication'

'TestApplication'

Description

Mixing control methods.
This project combines the user control mechanism from tutorial 2 with code to advance along a path that was introduced in tutorial 3.
The findClosestUnobstructedPoint() query is introduced.

Code from tutorial 2 and tutorial 3 is combined, as follows:
If there is a path then the agent advances automatically along that path.
If one of the direct control keys is pressed then any current path is deleted and control reverts back to the keys.

The findClosestUnobstructedPoint() query is used so that the agent will move close to the selected target position when possible even if the target position itself is obstructed.

Controls:

'4' - Place or move agent
'5' - Set a target for pathfinding
'6' to '9' - Place or move an obstacle
'W' - Move forwards
'S' - Move backwards
'A' - Move left
'D' - Move right

Notice that no matter where we move the agent under direct control, PathEngine will always understand how to pathfind from the agents current position.

It is not possible to set up a narrow gap with obstacles such that you can move into a location and get stuck!

(This is a result of the way PathEngine is set up with paired pathfinding and 'pathfinding collision' against a single world representation.)


Documentation for PathEngine release 6.00 - Copyright © 2002-2016 PathEnginenext: 'Swarm'