Sometime ago, for my work, I started to do an ActionScript3 port of the opensource library poly2tri.
The idea was to use it to do path finding in flash.
Polygocal path finding has three steps:
- Triangulation (in this case via the poly2tri library)
- Finding the shortest path between nodes. (Using an TRA*).
In this case I didn't need to split the search in several levels.
It is a simple A* with a node for each triangle including references to the contiguous triangles.
- The Funnel algorithm. Implementation Simple Stupid Funnel Algorithm
(I also did a Javascript port for this one).
Steps 2 and 3 are fast enough to be done at real time, at least with simple scenes.
First step maybe too, but in this case it is not required.
You can access the mercurial source code from here.
Here a working demo: