diff options
Diffstat (limited to 'modules/gdnavigation/nav_region.cpp')
-rw-r--r-- | modules/gdnavigation/nav_region.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/gdnavigation/nav_region.cpp b/modules/gdnavigation/nav_region.cpp index a07995bc11..c1690b2a4b 100644 --- a/modules/gdnavigation/nav_region.cpp +++ b/modules/gdnavigation/nav_region.cpp @@ -39,6 +39,9 @@ void NavRegion::set_map(NavMap *p_map) { map = p_map; polygons_dirty = true; + if (!map) { + connections.clear(); + } } void NavRegion::set_layers(uint32_t p_layers) { @@ -59,6 +62,25 @@ void NavRegion::set_mesh(Ref<NavigationMesh> p_mesh) { polygons_dirty = true; } +int NavRegion::get_connections_count() const { + if (!map) { + return 0; + } + return connections.size(); +} + +Vector3 NavRegion::get_connection_pathway_start(int p_connection_id) const { + ERR_FAIL_COND_V(!map, Vector3()); + ERR_FAIL_INDEX_V(p_connection_id, connections.size(), Vector3()); + return connections[p_connection_id].pathway_start; +} + +Vector3 NavRegion::get_connection_pathway_end(int p_connection_id) const { + ERR_FAIL_COND_V(!map, Vector3()); + ERR_FAIL_INDEX_V(p_connection_id, connections.size(), Vector3()); + return connections[p_connection_id].pathway_end; +} + bool NavRegion::sync() { bool something_changed = polygons_dirty /* || something_dirty? */; |