#3, by fulviovWednesday, 13. May 2015, 11:34 10 years ago
You have to think of waypoints as "helpers" that tell your character how to get to its destination when the start and end points cannot see each other (there is an obstacle in the middle, for example.)
I am not a Visionaire developer, but I believe this is how the action flow works:
- you click on a destination
- if there is line of sight between the character position and the destination, the character walks towards the destination.
- if there is NO line of sight, Visionaire finds the nearest waypoint with line of sight from your character location, and the nearest waypoint with line of sight from the destination point.
- Visionaire then calculates the route between these two waypoints using an algorithm, probably A*, and directs the character along this route.
- When there is visibility again between the character and the destination point, the character abandons the waypoint route and directs itself to the destination point.
You have to make sure that all points in your walking area have visibility to at least one waypoint for this to work properly.
With waypoints, you also have the nice side effect that when the destination point cannot be reached at all (you click outside the walking area, for example), the character will still walk to the nearest waypoint.