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.
Checking the stable version of the documentation...
NavigationRegion3D
實驗性: This class may be changed or removed in future versions.
可達的 3D 地區,NavigationAgent3D 能夠將其用於尋路。
說明
可達的 3D 地區,基於 NavigationMesh,NavigationAgent3D 能夠將其用於尋路。
兩個地區如果存在相近的邊就可以互相連接。連接兩條邊所需的頂點最小間距可以通過 NavigationServer3D.map_set_edge_connection_margin() 設定。
注意:兩個地區存在重疊部分並不足以讓它們相連。必須有相近的邊。
從一個地區進入另一個地區的尋路成本可以使用 enter_cost 控制。
注意:起點位於該地區時,這個值不計入路徑成本。
在該地區中行進的尋路成本可以使用乘數 travel_cost 控制。
注意:該節點會對這些屬性進行快取,因此,你在 NavigationServer3D 中對底層的地區 RID 進行的修改不會在該節點的屬性中。
教學
屬性
|
||
|
||
|
||
|
||
|
方法
void |
bake_navigation_mesh(on_thread: bool = true) |
get_bounds() const |
|
get_navigation_layer_value(layer_number: int) const |
|
get_navigation_map() const |
|
get_region_rid() const |
|
get_rid() const |
|
is_baking() const |
|
void |
set_navigation_layer_value(layer_number: int, value: bool) |
void |
set_navigation_map(navigation_map: RID) |
訊號
bake_finished() 🔗
導覽網格烘焙操作完成時發出通知。
navigation_mesh_changed() 🔗
NavigationMesh 發生變化時發出通知。
屬性說明
決定該 NavigationRegion3D 是啟用還是禁用。
When pathfinding enters this region's navigation mesh from another regions navigation mesh the enter_cost value is added to the path distance for determining the shortest path.
確定該區塊所屬的所有導覽層的位欄位。當使用 NavigationServer3D.map_get_path() 請求一個路徑時,可以檢查這些導覽層。
NavigationMesh navigation_mesh 🔗
void set_navigation_mesh(value: NavigationMesh)
NavigationMesh get_navigation_mesh()
使用的 NavigationMesh 資源。
When pathfinding moves inside this region's navigation mesh the traveled distances are multiplied with travel_cost for determining the shortest path.
bool use_edge_connections = true 🔗
如果啟用,導覽區塊將使用邊緣連接來與位於導覽地圖連接邊距範圍內的其他導覽區塊相連接。
方法說明
void bake_navigation_mesh(on_thread: bool = true) 🔗
烘焙該 NavigationMesh。如果 on_thread 被設定為 true(預設),則該烘焙將在單獨的執行緒上完成。獨立執行緒烘焙很有用,因為導覽烘焙不是一項廉價的操作。完成後,它會自動設定新的 NavigationMesh。請注意,如果幾何體是從網格解析而來的,則獨立執行緒烘焙可能會非常慢,因為對每個網格的非同步存取會涉及大量同步操作。另外,請注意在無法使用執行緒的作業系統(例如禁用執行緒的 Web)上,會自動禁用獨立執行緒烘焙。
Returns the axis-aligned bounding box for the region's transformed navigation mesh.
bool get_navigation_layer_value(layer_number: int) const 🔗
返回 navigation_layers 位元遮罩中指定的層是否啟用,給定的 layer_number 應在 1 和 32 之間。
RID get_navigation_map() const 🔗
設定該連結的導覽地圖 RID。
已棄用: Use get_rid() instead.
Returns the RID of this region on the NavigationServer3D.
返回 NavigationServer3D 上該區塊的 RID。結合 NavigationServer3D.map_get_closest_point_owner() 可用於識別距離該合併導覽地圖上的點最近的 NavigationRegion3D。
Returns true when the NavigationMesh is being baked on a background thread.
void set_navigation_layer_value(layer_number: int, value: bool) 🔗
根據 value,啟用或禁用 navigation_layers 位元遮罩中指定的層,給定的 layer_number 應在 1 和 32 之間。
void set_navigation_map(navigation_map: RID) 🔗
設定該區域應使用的導覽地圖的RID。預設情況下,該區域將自動加入World3D預設導覽地圖,因此僅需要此函式來覆寫預設地圖。 “,““,“,“錯誤的”,””,”,”
doc/classes/Node.xml"