This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
預設的 3D edge_connection_margin 可以在 ProjectSettings 的 navigation/3d/default_edge_connection_margin 進行設定。
任何導覽地圖的邊緣連接邊距值,也可在執行時透過 NavigationServer API 動態調整。
extendsNode2Dfunc_ready()->void:# 2D margins are designed to work with 2D "pixel" values.vardefault_map_rid:RID=get_world_2d().get_navigation_map()NavigationServer2D.map_set_edge_connection_margin(default_map_rid,50.0)
usingGodot;publicpartialclassMyNode2D:Node2D{publicoverridevoid_Ready(){// 2D margins are designed to work with 2D "pixel" values.RiddefaultMapRid=GetWorld2D().NavigationMap;NavigationServer2D.MapSetEdgeConnectionMargin(defaultMapRid,50.0f);}}
extendsNode3Dfunc_ready()->void:# 3D margins are designed to work with 3D world unit values.vardefault_map_rid:RID=get_world_3d().get_navigation_map()NavigationServer3D.map_set_edge_connection_margin(default_map_rid,0.5)
usingGodot;publicpartialclassMyNode3D:Node3D{publicoverridevoid_Ready(){// 3D margins are designed to work with 3D world unit values.RiddefaultMapRid=GetWorld3D().NavigationMap;NavigationServer3D.MapSetEdgeConnectionMargin(defaultMapRid,0.5f);}}