连接导航网格
如果不同的 NavigationMesh 至少有一条边的两个顶点位于完全重合的位置,那么 NavigationServer 就会自动将这两个网格合并。
要连接任意距离的两个位置,见 使用 NavigationLink。
The same is true for multiple NavigationPolygon resources. As long as their outline points overlap exactly the NavigationServer will merge them. NavigationPolygon outlines must be from different NavigationPolygon resources to connect.
Overlapping or intersecting outlines on the same NavigationPolygon will fail the navigation mesh creation. Overlapping or intersecting outlines from different NavigationPolygons will often fail to create the navigation region edge connections on the NavigationServer and should be avoided.
警告
Exactly means exactly for the vertex position merge. Small float errors that happen quite regularly with imported meshes will prevent a successful vertex merge.
Alternatively navigation meshes are not merged but still considered as connected by the NavigationServer when their edges are nearly parallel and within distance to each other. The connection distance is defined by the edge_connection_margin
for each navigation map. In many cases navigation mesh edges cannot properly connect when they partly overlap. Better avoid any navigation mesh overlap at all time for a consistent merge behavior.
If navigation debug is enabled and the NavigationServer active the established navigation mesh connections will be visualized. See 导航调试工具 for more info about navigation debug options.
默认的 2D edge_connection_margin
可以在 ProjectSettings 的 navigation/2d/default_edge_connection_margin
中修改。
默认的 3D edge_connection_margin
可以在 ProjectSettings 的 navigation/3d/default_edge_connection_margin
中修改。
The edge connection margin value of any navigation map can also be changed at runtime with the NavigationServer API.
GDScript
extends Node2D
# 2D margins are designed to work with "pixel" values
var default_2d_map_rid: RID = get_world_2d().get_navigation_map()
NavigationServer2D.map_set_edge_connection_margin(default_2d_map_rid, 50.0)
GDScript
extends Node3D
# 3D margins are designed to work with 3D unit values
var default_3d_map_rid: RID = get_world_3d().get_navigation_map()
NavigationServer3D.map_set_edge_connection_margin(default_3d_map_rid, 0.5)
备注
Changing the edge connection margin will trigger a full update of all navigation mesh connections on the NavigationServer.
© 版权所有 2014-present Juan Linietsky, Ariel Manzur and the Godot community (CC BY 3.0). Revision b1c660f7
.
Built with Sphinx using a theme provided by Read the Docs.