在烘焙完了navMesh之后,就可以为放置在navmesh上的物体进行寻路了.
NavigationMeshAgent是所有需要导航的物体需要添加的控件.通过对Destination的设定可以让其物体自动移动.自动移动时,会改变其velocity.
当然,也可以通过CalculatePath()函数来获取计算出的路径而不进行移动操作.
Property: | Function: |
---|---|
Radius | Radius around the agent within which obstacles should not pass. |
Speed | Maximum movement speed (in world units per second). |
Acceleration | Maximum acceleration (in world units per second squared). |
Angular Speed | Maximum speed of rotation (degrees per second). |
Stopping distance | Minimum distance from the target within which the agent can stop. |
Auto Traverse OffMesh Link | Should off-mesh links be crossed automatically without intervention from a script? |
Auto Repath | Should a new path be calculated if the current one becomes obstructed or invalid? |
Auto Braking | Should the agent automatically slow down as it approaches the target point? |
Height | The height clearance the agent needs to pass below an obstacle overhead. |
Base offset | Height difference between the anchor point of the GameObject and the centre point of the agent’s cylinder. |
Obstacle Avoidance Type | An approximate quality level for obstacle avoidance. |
Avoidance Priority | Agents of lower priority will be ignored by this agent when performing avoidance. The value should be in the range 0..99 where lower numbers indicate higher priority. |
NavMesh Walkable | Specifies the Navmesh layers that the agent can traverse. |
图片中的Acceleration表示的是加速度,表示每秒速度的最大变化量. 但除此之外,这个值还表示了物体转弯儿时的最大加速度,当此值较小时,转弯弧度会比较大,较大时,转弯弧度会很小.
Angular Speed表示的物体自身旋转的速度,即物体运动方向改变时,物体朝向的变化速度.