路径测试1
This commit is contained in:
parent
144727feb3
commit
a3e794dd82
@ -88,20 +88,21 @@ public class RecuseNpc : MonoBehaviour
|
||||
{
|
||||
Debug.Log(tar+"目标路径点");
|
||||
|
||||
//target.position = tar;
|
||||
//Debug.Log(target);
|
||||
//NavMeshHit hit;
|
||||
//if (!NavMesh.SamplePosition(tar, out hit, 1.0f, NavMesh.AllAreas))
|
||||
//{
|
||||
// Debug.LogError($"目标点 {target} 不在导航网格上");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// tar = hit.position; // 将目标点调整到最近的导航网格位置
|
||||
//}
|
||||
//Debug.Log("进入奔跑++++++=");
|
||||
//targetPoints.Add(tar);
|
||||
navMeshAgent.SetDestination(tar);
|
||||
target.position = tar;
|
||||
Debug.Log(target);
|
||||
NavMeshHit hit;
|
||||
if (!NavMesh.SamplePosition(tar, out hit, 1.0f, NavMesh.AllAreas))
|
||||
{
|
||||
Debug.LogError($"目标点 {target} 不在导航网格上");
|
||||
}
|
||||
else
|
||||
{
|
||||
tar = hit.position; // 将目标点调整到最近的导航网格位置
|
||||
}
|
||||
Debug.Log("进入奔跑++++++=");
|
||||
targetPoints.Clear();
|
||||
targetPoints.Add(tar);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user