格子地图生成导航网格


1 Use Marching Squares algorithm to convert obstacle tiles into outlines. Note that map edges is an outline too and need to be included as well.
2 Reduce number of points in outlines using Douglas-Peucker algorithm (purple lines on the bottom picture)
3 Feed all points into Delaunay triangulation (to get most uniform triangles)
4 Add additional points in empty areas and along the map edges (to get more even navmesh)
5 Check along obstacle outlines and flip polygons produced by Delaunay to match outlines. - Often Delaunay could place triangles (grey) mismatching your outlines (red), then you need to detect and flip them. Adjoining them back into a polygon, split it along outline(s) and triangulate it manually enter image description here
     enter image description here
6 Clip obstacles innards - remove polygons that are within obstacles (pink on the picture above)
     tilemap navmesh
7 Fill in connectivity data between remaining triangles and vertices as you need - that's your navmesh.

转载于:https://www.cnblogs.com/Hichy/p/8425554.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值