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.

使用 NavigationLayer

NavigationLayers are an optional feature to further control which navigation meshes are considered in a path query. They work similar to how physics layers control collision between collision objects or how visual layers control what is rendered to the Viewport.

NavigationLayers可以在 ProjectSettings 中与物理层或视觉层相同地命名。

../../_images/navigationlayers_naming.png

如果一个区域没有一个与路径查询的 navigation_layers 参数兼容的导览层,则在寻路时将跳过该区域的导览网格。有关查询导览服务器路径的更多信息,请参阅 使用 NavigationPath

NavigationLayers是用作 bitmask 的单个 int 值。许多与导航相关的节点都具有 set_navigation_layer_value()get_navigation_layer_value() 函数,可以直接设置和获取层数,而不需要更复杂的逐位操作。

在脚本中,以下辅助函数可用于处理 navigati