游戏AI关键组件NavMesh Agent

1.选中所需烘培的object,打开Navigation面板,记得选中Navigation Static

游戏AI关键组件NavMesh Agent

Bake面板烘培,烘培后我自动创建一个与场景同名的文件夹,里面就存着Nav

游戏AI关键组件NavMesh Agent

2.把怪物拖拽进场景,添加游戏AI关键组件NavMesh Agent

游戏AI关键组件NavMesh Agent

3.以下写了一个简单的怪物追主角的脚本

游戏AI关键组件NavMesh Agent

Stopping Distance最好设置一下,值为0且碰撞体没调好,会出现两个object一直撞的情况。

————————————————————— 以下来自圣典————————————————————————————————

The NavMesh Agent component is used in connection with pathfinding, and is the place to put information about how this agent navigates the NavMesh. You can access it in Component->Navigation->Nav Mesh Agent

导航网格代理(NavMesh Agent )组件用于寻路,是存放代理如何在导航网格(NavMesh)中导航的信息的地方。你可以在Component->Navigation->Nav Mesh Agent访问。

游戏AI关键组件NavMesh Agent

游戏AI关键组件NavMesh Agent