NavMesh illustrates the path hunt algorithm funnel

NavMesh pathfinding is a technique widely used to generate a continuous polygon / triangle mesh map can take part in the pathfinding grid, mainly comprising two steps: 1, according to the configuration of FIG mesh adjacency information using a * such routing algorithm to calculate the need to go through from the beginning to focus polygon / triangle set; 2, using a funnel algorithm / algorithms rope, it is converted to an optimal Road polygon list. This article mainly to talk about the funnel principle for the triangle list algorithms.

If you readers search through the network, you will find someone talking about this year GDC algorithm, there are several blog translate this GDC lecture slides, but most of all just slides levels of translation again, I did not really understand the algorithm says, lead to when I realized this algorithm encountered great difficulties, but fortunately finally hang of it.

 

Read this article requires a certain pre-knowledge, you need to know NavMesh its corresponding triangular mesh, as well as units in the pathfinding triangle NavMesh list of intermediate results.

 

Algorithm results

As shown, assume that the triangle list on the left is generated from the routing algorithm from start to finish to go through the triangle, two blue dots are the starting point and focus; to the right of the green thick line is the result of the algorithm, it is from the beginning to the end to go through the shortest path.

image



Algorithmic process

  • First, calculate the adjacent edge list listing triangle, two triangles is called common abutting side edges, and from the starting point, the first configuration to the adjacent edge of the funnel, the algorithm started.

Yellow side edges are adjacent, the two sides of the initial green funnel, two tentatively agreed "funnel side" of the "starting point" for the blue dot, the foregoing description is convenient

image

  • The two end edges of the funnel is moved to the next adjacent edge, in the case of the way, the left edge does not move (but get on logic moved), the right edge inwardly tightened.

Respectively account for variations in the angle of the two edges, when the hopper is narrowed (or not change), this movement is effective, the need for that edge or back operation, for the case of FIG., It is effective to move

Seen in FIG funnel narrows

image

  • The continued movement of the end edge of the funnel to the next adjacent edge of the funnel continue to tighten, effectively move, after the two steps are the same and the case of FIG.

imageimage

  • First appeared in the next step a special case, when the end of the funnel side move to the next adjacent edge, the angle of the mouth of the funnel becomes negative (the original to the right side of the hopper to the left), in this case, is that the cover past edges of the end became the first point results.

At the same time, the funnel is moved to the starting point to the current starting point of the funnel where the adjacent edge of the triangular configuration of the funnel , the algorithm continues

imageimage

  • Use rules described earlier continue to tighten funnel mouth

imageimageimage

  • Continue to move the funnel, and this time will find that there is no movement on the left side of the funnel, and the funnel on the right side of the mouth of the funnel will become larger, move the right is invalid. The only move left has moved (although the same start and end points)

image

  • Here is the end of the case the algorithm, the algorithm has been moved to the side adjacent to the last, but from now on the bottom of the funnel is connected directly to the finish line is certainly not feasible. Then we end with a point, as one of the two sides of the same endpoint. It continues to move forward with the mouth of the funnel.

If the right edge of the funnel moving funnel mouth will become larger, and therefore does not move to the left while moving the funnel, the funnel will be overshadowed by the right side, so the end of the right side of the funnel becomes another point results.

image

  • Similarly, the point is located adjacent to the sides of the triangle reconfigured funnel, the algorithm continues, will soon find a funnel opening to the end, received a minimum, the algorithm ends.

imageimage

Guess you like

Origin www.cnblogs.com/pointer-smq/p/11332897.html