Nav nav mesh pathfinding (7)-code and some optimizations

Source: Internet
Author: User
This article is a turn, the original http://blianchen.blog.163.com/blog/static/131056299201031293039882/

Here cannot send the source code, this series complete source code can go to http://bbs.9ria.com/thread-49841-1-1.html under.

See, the optimal path should be to bypass the middle block from above, and the actual path of the road is actually the following. This is because, when the grid area is too large or there is an edge length is too long, because the cost of a * is to calculate the distance between the midpoint of the grid and not the actual path length, so the resulting path deviation is large. So in the general grid generation algorithm will be added to the grid minimum area and maximum area limit, if the resulting mesh is less than the minimum area is discarded, if greater than the maximum area is split.

An island is created in a general map, such as a two block area crossing, which creates an island in the middle Crimson region after merging. In accordance with the clipping algorithm described above, the middle Island polygons are stored in a counterclockwise direction (other clockwise), so in this step it is possible to determine whether to create an island. For the isolated islands, if the game allows people to enter the island through the way of transient, then the island also need to generate a nav grid, but the island's Nav grid and other areas of the grid can best be divided into different regions, so that in the pathfinding can be optimized (starting point and end of the same region, can be directly determined to not pass).

Nav nav mesh pathfinding (7)-code and some optimizations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.