1. 程式人生 > >遊戲AI關鍵元件NavMesh Agent

遊戲AI關鍵元件NavMesh Agent

1.選中所需烘培的object,開啟Navigation面板,記得選中Navigation Static


Bake面板烘培,烘培後我自動建立一個與場景同名的資料夾,裡面就存著Nav

2.把怪物拖拽進場景,新增

3.以下寫了一個簡單的怪物追主角的指令碼


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訪問。