欢迎

How more than you show,speak less than you know.

暂存

Recast开源库介绍

效率对比

项目中的选择

附录

  1. Unity的导航系统官方手册:https://docs.unity3d.com/2017.4/Documentation/Manual/Navigation.html
  2. A*Pathfinding官方手册:https://www.arongranberg.com/astar/documentation/4_2_4_75066e20/beginner.html
  3. NavMesh生成原理(原版):http://critterai.org/projects/cainav/doc/html/e72bd1ee-04b0-4bbb-a21d-d8d7ecaa11af.htm
    另一版本:http://www.critterai.org/projects/nmgen_study/
  4. A*Pathfinding简易教程:https://blog.csdn.net/lyh916/article/details/45500709
  5. 深入理解游戏中的寻路算法:http://gad.qq.com/article/detail/33637
  6. 寻路算法可视化演示:https://qiao.github.io/PathFinding.js/visual/
  7. 寻路建模的三种方式比较:https://blog.csdn.net/needmorecode/article/details/82050409
  8. Recast开源库:https://github.com/recastnavigation/recastnavigation

 

每个节点都存储它所连接的其他节点。 如何表示这取决于图表。 例如,网格图利用其网格结构,并且可以仅在一个字节中存储与其相邻网格节点的所有连接! 与例如对其他节点的引用数组相比,这显着更高的存储器效率,因为其将使用至少80倍的存储器。

您可以使用GetConnections方法访问节点的所有连接。 此方法接受一个委托,该委托将为其连接的每个节点调用,并抽象出底层表示。


其他

Batch Graph Updates没看懂(Advanced晚点再看吧 以及Optimization)

Graph Types的适用场景

如果将网格图检查器中的“形状”选项设置为“六边形”,则网格图也可以用作六边形图。 如果您想查看示例,可以查看名为“Example14_TurnBased_Hexagon”的示例场景。

扩展知识

多线程

启发式算法

为什么插件和系统差距这么大

开源库是C++的

多层区域 unity的导航系统支持吗

插件的离网系统

视频教程看一看

CharacterController

Grid 和NavMesh的用途

AIDestinationSetter

unity的寻路的确是最短路径,就是贴着边走的,但可以使用FindClosestEdge函数来调整路点的位置,示意代码如下: NavMeshPath navPath = new NavMeshPath();
http://www.manew.com/thread-94163-1-1.html

关于Navmesh有时不按照最优路线走
Navmesh graphs can sometimes give suboptimal paths. This is because pathfinding is carried out on node (triangle) centers. It happens mostly when the navmesh has very large and very small nodes (triangles) placed close to each other. The pathfinding then usually prefers the path with smaller triangles (sometimes the one with larger triangles, but not as common).
《暂存》

In the above image, the found path is shown in green, the nodes it passes through in pale orange. The actual shortest path is shown in red, with the nodes it passes through in pale red.

There is no silver bullet for this. Try to avoid very large triangles close to small ones. For recast graphs (see below), you can specify a lower tile size to split up very large triangles into smaller ones. And the Max Edge Length can be lowered as well.

 

关于Navmesh生成,为什么使用Tile的几个原因
. Having tiles is usually better however because of a few reasons:

It makes it possible to scan the different tiles in parallel which can make the scan a lot faster.

You can update individual tiles in a recast graph during runtime, which is faster than updating the whole graph.

navmesh cutting operates on a tile by tile basis and updating a smaller part of the graph is faster.

It breaks up very large polygons which reduces the risk of very suboptimal paths (more about this in Using navmeshes).

如果想取消上一个路径请求,可以通过调用Seeker.CancelCurrentPathRequest()来记录警告。

 

Any graph which implements the IUpdatableGraph interface can be updated during runtime.

任何实现IUpdatableGraph接口的图都可以在运行时更新。

 

 

 

 

 

重铸图表基于Recasthttp://code.google.com/p/recastnavigation/)。
我已将其中很大一部分翻译成C#,以便在Unity中本地运行它。

 

unity系统的2D寻路

正常情况下不是Awake时生成地图吗。

工作原理

通过一个例子来了解Astarpathfinding的工作原理:

 

如何分辨高度
In order to place the nodes at their correct height, the A* system fires off a bunch of rays against the scene to see where they hit. That’s the Height Testing settings.

关于射线,没看懂
A ray, optionally thick (as opposed to a line), is fired from [Ray Length] units above the grid downwards, a node is placed where it hits. If it doesn’t hit anything, it is either made unwalkable if the Unwalkable When No Ground variable is toggled or the node is placed at Y=0 relative to the grid if it is set to false.

从demo讲
https://www.arongranberg.com/astar/documentation/4_2_4_75066e20/custom_movement_script.html

谁才是寻路的真正执行者 seeker做了什么

进阶

写自己的modifiers

Cellsize类似于半径
cellsize变小
Rasterization resolution has a great effect on the time it takes to generate a recast graph, but it has no direct impact on the runtime performance of it (except of course, full graph updates). Indirectly it can affect it slightly since a large resolution can add more detail to the graph.

As recast graphs for larger worlds can take quite some time to scan. You may want to cache the result to improve startup times.

Max Nearest Node Distance Heuristic

In the image below you can see a comparison of the different heuristic options for an 8-connected grid and for a 4-connected grid. Note that all paths within the green area will all have the same length. The only difference between the heuristics is which of those paths of the same length that will be chosen. Note that while the Diagonal Manhattan and Manhattan options seem to behave very differently on an 8-connected grid they only do it in this case because of very small rounding errors. Usually they behave almost identically on 8-connected grids.

Generally for a 4-connected grid graph the Manhattan option should be used as it is the true distance on a 4-connected grid. For an 8-connected grid graph the Diagonal Manhattan option is the mathematically most correct option, however the Euclidean option is often preferred, especially if you are simplifying the path afterwards using modifiers.

For any graph that is not grid based the Euclidean option is the best one to use.

navcut会不会影响寻路,还是只是本地躲避。需要用一个Demo来演示最好加到下章节。

罚分到底是什么

TileHandlerHelper 被弃用了? 有必要讲一下

注意文档的版本

RVO的算法介绍写一下

 

 

时间充裕的话加一些动图

要不要写一下例子都是干嘛的例如

There are three example scenes included which show how the local avoidance system works. You can find them in Assets/AstarPathfindingProject/ExampleScenes/Example11_RVO as well as in Assets/AstarPathfindingProject/ExampleScenes/Example16_RVO 2D.

 

在RVO中的最后这句话没看懂

So how fast is this system then, you might wonder. It is very high performance. Especially if you take into account the fact that a local avoidance simulation does not need to run at a very high fps, that’s just a waste of CPU cycles because the quality won’t improve much. I

 

移动的障碍物是要添加到RVo还是怎样,按理来说 rvo系统应该避开所有不可以预测障碍 为什么还是需要为障碍物添加rvo系统的脚本 甚至过快移动也无法使用rvo系统避障

ai漫游 位掩码 扩展系统 访问图形数据   先不看

 

https://medium.com/@nicholas.w.swift/easy-a-star-pathfinding-7e6689c7f7b2 这个网址记得看

https://www.raywenderlich.com/3016-introduction-to-a-pathfinding 还有这个

 

DynamicGridObstacle 这个类是干嘛的

插件中的动态寻路怎么做

AstarPath.Scan)是什么功能 前面怎么没介绍

要以与开始时计算的方式相同的方式重新计算图形的一小部分,可以对除NavMeshGraph之外的所有图形进行重新计算,因为通常只有完全重新计算它才有意义。使用脚本和GraphUpdateScene组件执行此操作的方法是将名为“updatePhysics”的字段设置为true。它可能不是最具描述性的名称,抱歉。

updatePhysics这个字段到底是干什么的

Perlin noise是什么

发表评论

电子邮件地址不会被公开。 必填项已用*标注