NavMeshAgent 寻路导航组件

1 NavMesh 地面的烘焙方法

1.选中要导航的模型 或者 地面

2.在U3D右边Inspector面板右上角Static旁边的倒三角 ,选中 Navigation static 勾, 表示地面导航层 ,把当前选中物体设置为导航层

3.菜单栏Window ->Navigation ,Inspector面板 右下角 Bake烘焙,生成导航路径数据

4.然后要移动的角色身上添加 NavMeshAgent组件,就可以导航移动角色

1 NavMeshAgent 组件面板属性

Base offset                与地面偏移高度
speed                        移动速度
Angular Speed             转角速度 ,转身速度    角速度: 最高转速(度/秒)。
Acceleration                 加速度,启动时的 最大加速度。
Stopping Distance         停止距离 ,,制动距离:制动距离。到目的地的距离小于这个值,代理减速。
Auto Traverse OffMesh Link 自动遍历OffMesh链接:自动移动并关闭OffMeshLinks
Auto Repath                 自动重新寻路:如果现有的部分已失效,获得新的路径。
Height                         高度:代理的高度(用于调试图形)。
Base offset                   基本偏移:碰撞几何体相对于实际几何体垂直的偏移。
Obstacle Avoidance Type 障碍躲避类型 :躲避的质量水平。
NavMesh Walkable          导航网格行走:指定代理可以遍历的导航网格层类型。这个参数很有用,在接下来的实例中可以用到。

1 所有NavMeshAgent 函数和变量翻译

NavMeshAgent.acceleration 加速度
NavMeshAgent.ActivateCurrentOffMeshLink 激活当前分离网格链接
NavMeshAgent.angularSpeed 角速度
NavMeshAgent.areaMask 区域遮挡
NavMeshAgent.autoBraking 自动制动
NavMeshAgent.autoRepath 自动重新获取路径
NavMeshAgent.autoTraverseOffMeshLink 自动穿过OffMeshLink
NavMeshAgent.avoidancePriority 逃避优先级
NavMeshAgent.baseOffset 基础偏移
NavMeshAgent.CalculatePath 计算路径
NavMeshAgent.CompleteOffMeshLink 完成分离网格链接
NavMeshAgent.currentOffMeshLinkData 当前关闭网格连接数据
NavMeshAgent.desiredVelocity 需求速度
NavMeshAgent.destination 目的地
NavMeshAgent.FindClosestEdge 寻找最近边缘
NavMeshAgent.GetAreaCost 获取区域成本
NavMeshAgent.hasPath 有路径
NavMeshAgent.height 高度
NavMeshAgent.isOnNavMesh 是否在导航网格上
NavMeshAgent.isOnOffMeshLink 是否在OffMeshLink上
NavMeshAgent.isPathStale 是否是旧路径
NavMeshAgent.Move 移动
NavMeshAgent.nextOffMeshLinkData 下一个OffMeshLink数据
NavMeshAgent.nextPosition 下个位置
NavMeshAgent.obstacleAvoidanceType 障碍逃避类型
NavMeshAgent.path 路径
NavMeshAgent.pathPending 路径等待
NavMeshAgent.pathStatus 路径状况
NavMeshAgent.radius 半径
NavMeshAgent.Raycast 射线投影
NavMeshAgent.remainingDistance 剩余距离
NavMeshAgent.ResetPath 重新设置路径
NavMeshAgent.Resume 恢复
NavMeshAgent.SamplePathPosition 样本路径位置
NavMeshAgent.SetAreaCost 设置区域成本
NavMeshAgent.SetDestination 设置目的地
NavMeshAgent.SetPath 设置路径
NavMeshAgent.speed 速度
NavMeshAgent.steeringTarget 转向目标
NavMeshAgent.Stop 刹车
NavMeshAgent.stoppingDistance 刹车距离
NavMeshAgent.updatePosition 更新位置
NavMeshAgent.updateRotation 更新旋转
NavMeshAgent.velocity 速度
NavMeshAgent.Warp 弯曲

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 前言:在游戏中经常出现怪物自己会走路,人物跟随鼠标点击位置进行移动,那么这些功能是怎么实现的呢?通过本节内容的学习...
    Joe_Game阅读 6,289评论 0 3
  • Unity3D塔防开发流程 配置环境及场景搭建 编程语言:C#,略懂些许设计模式,如果不了解设计模式,BUG Mo...
    Grape_葡萄阅读 3,009评论 1 3
  • 这篇文章,首先会介绍什么是导航网格,它在 3D 游戏中起到了什么样的作用。然后会介绍目前导航寻路最常用的第三方开源...
    MobiusChen阅读 13,506评论 3 22
  • This article is a record of my journey to learn Game Deve...
    蔡子聪阅读 3,875评论 0 9
  • 原来简书也有手绘板块,第一次发~发张我画的张若昀同学吧~ 画的不好,请见谅哦~
    云翳黯淡阅读 2,196评论 14 14