AgentRadius:烘焙路径可行区域和非可行区域的间隔
AgentHeight:烘焙路劲时当高度小于这个值的地方,就是不可行区域
Max Slope:最大可行区域的坡度
Step Height:最大台阶高度
Drop Helght:下路高度
Jump Distance:最大跳跃距离
自动寻路(寻路组件)
Base offset:组件的竖直方向的偏移量
Speed:速度
Agular Speed:角速度(旋转的速度)
Acceleration:加速度(加速度是矢量,有大小有方向,在加速时是加速度,减速时是减速的加速度)
StoppingDistance:距离目标点多远就停止(速度不能太快,加速度不能太小,否则跟目标点距离等于stoppingdistance时停不下来)
Radiu:寻路组件的半径
Height:寻路组件高度
Quality:寻路精确度,速度越快对寻路精细度要求越高
Priority:寻路权重(0-99,值越小优先级越高,优先级低的游戏寻路组件需要绕着他走)
Auto traverse off mesh Link:是否支持off mesh link 功能
Auto repath:自动重新规划路线
Area Mask:区域覆盖,当前寻路组件没有覆盖的区域,即使有可行驶的区域,对当前这个组件来说也是不可行区域
挂载到需要自动训寻路的npc上,End代表要去往的目的地
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class testNavigation : MonoBehaviour
{
private NavMeshAgent myAgent;
public GameObject End;
// Start is called before the first frame update
void Start()
{
myAgent = gameObject.GetComponent<NavMeshAgent>();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.A))
{
myAgent.SetDestination(End.transform.position);
}
}
}
实现从低点到高点跳跃
从jumpstart的位置到jumpend的位置