在我的之前文章中,已经详细写出鼠标控制物体方法,在这里我就只列出代码不进行详细解释了,
private NavMeshAgent agent;
void Start () {
agent = GetComponent<NavMeshAgent>();
}
void Update () {
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray,out hit))
{
if (Input.GetMouseButtonDown(0))
{
agent.SetDestination(new Vector3(hit.point

本文介绍了如何在Unity中使用Nav Mesh Obstacle进行实时烘焙,通过添加附件到障碍物上,实现动态导航网格避障。无需将障碍物设为静态,其他静态地面障碍物依然需要设置。
2067

被折叠的 条评论
为什么被折叠?



