Original Post
Hi there, I have a problem, finding the "best" path on my navigation mesh (convex polygons of arbitrary size, auto-generated from level geometry). Here is a picture to illustrate my issue:
The blue polygons (A-J) are my navigation polygons, the black area is not walkable. I use A* for finding the path. The estimated cost is just the distance from the edge-center to the destination. The movement cost is the distance from one center of an edge to the next center of an edge (green dots). After a path is found I smooth the waypoints (move them along their edge) to straighten the path. When I do a search from position (S) to position (E) the algorithm will always come up with the yellow solution (H,I,E,C,B), because the red one (H,A,B) is slightly longer. Of course, this is because the centerpoints of each edge are pretty far away. But it doesn't "feel" right if you look at it, right ? ;) Does anyone has an idea how to improve my cost calculation ? Or a better solution at all ? :-) Thanks in advance, Markus
The blue polygons (A-J) are my navigation polygons, the black area is not walkable. I use A* for finding the path. The estimated cost is just the distance from the edge-center to the destination. The movement cost is the distance from one center of an edge to the next center of an edge (green dots). After a path is found I smooth the waypoints (move them along their edge) to straighten the path. When I do a search from position (S) to position (E) the algorithm will always come up with the yellow solution (H,I,E,C,B), because the red one (H,A,B) is slightly longer. Of course, this is because the centerpoints of each edge are pretty far away. But it doesn't "feel" right if you look at it, right ? ;) Does anyone has an idea how to improve my cost calculation ? Or a better solution at all ? :-) Thanks in advance, Markus