Unity3D 导航寻路

先选择Window-->Navigation 在新打开的窗口中点击Bake.

待烘焙结束之后。

给需要导航的物体添加NavMeshAgent组件。可以调整速Speed Radius 等。

然后

1 NavMeshAgent agent = this.GetComponent<NavMeshAgent>();
2 //设置目标
3 agent.SetDestination(player.position);
4 //停止
5 agent.Stop();

 

posted @ 2015-08-25 20:51  Akishimo  阅读(219)  评论(0编辑  收藏  举报