添加新物体,命名为Player,添加组件Nav Mesh Agent.同时添加Navigation,将
需要进行自动寻路的地方进行烘焙。创建脚本Follow:
using UnityEngine; using System.Collections;
public class Follow : MonoBehaviour
{
public Transform target;
private NavMeshAgent agent; void Start() { agent = GetComponent<NavMeshAgent>(); }
// Update is
|
[Unity3D]Unity3D自动寻路Demo
最新推荐文章于 2024-02-21 16:46:08 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)