Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

使用 NavigationAgent

NavigationAgent 即导航代理,是一种辅助节点,能够为继承自 Node2D/3D 的父节点提供寻路、路径跟随、代理躲避等功能。这类节点会代替父级角色节点对 NavigationServer API 进行常见的调用,针对初学者进行了优化。

2D 和 3D 版本的 NavigationAgent 分别是 NavigationAgent2DNavigationAgent3D

新建的 NavigationAgent 节点会自动加入 World2D/World3D 的默认导航地图。

NavigationsAgent 节点是可选的,不是使用导航系统的硬性要求。对应的功能都可以用脚本代替,替换为对 NavigationServer API 的直接调用。

小技巧

For more advanced uses consider 使用 NavigationPathQueryObject over NavigationAgent nodes.