diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-17 09:18:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-17 09:18:54 +0100 |
commit | 08ca4184f407419f4265bdc0add21ac2e78bef7e (patch) | |
tree | 9dcd4f5877e049c34b7d0fc44b85b93872b49d09 /modules/gdnavigation/nav_region.cpp | |
parent | 9ca0d66a3b51084eb528a85e133d9037b21bdd09 (diff) | |
parent | ac7073f58655094d08daf59e3b1b36946c5ee02b (diff) |
Merge pull request #47024 from groud/navigation
Allow Navigation to be more flexible
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? */; |