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/Node3D 類型的父節點。它們以更直觀的方式,協助父角色節點呼叫 NavigationServer API,對初學者特別友善。

NavigationAgent 有 2D 與 3D 版本,分別為 NavigationAgent2DNavigationAgent3D

新的 NavigationAgent 節點會自動加入 World2DWorld3D 的預設導航地圖。

NavigationAgent 節點為選用元件,並非使用導航系統的必要條件。其所有功能皆可透過腳本直接呼叫 NavigationServer API 實作。

小訣竅

若需更進階的用法,請考慮使用 使用 NavigationPathQueryObject,而非僅使用 NavigationAgent 節點。