Vector3 randomPoint = center + Random.insideUnitSphere * range; if (NavMesh.SamplePosition(randomPoint, out hit, 1.0f, NavMesh.AllAreas)) { returnagent.transform.position, walkRadius, out randomDirection
我创建了一个类来移动游戏对象,如下所示: private NavMeshAgent _thismove;correct.but,在添加那一行之后,我得到了"SetDestination" can only be called on an active agent that has been placed on a NavMesh
我需要反转这个脚本,这个脚本用来制作一个游戏对象,以便在一些转换之间进行巡逻。我需要对象从点(1,2,3,4,5)开始依次导航,当它到达数组的末尾时,它会颠倒数组本身的顺序,这样它就会向后导航(5,4,3,2 ,1)。 using UnityEngine;public class Patrol : MonoBehaviour private int destPoint = 0;
void Star