diff options
author | smix8 <52464204+smix8@users.noreply.github.com> | 2022-06-22 10:16:38 +0200 |
---|---|---|
committer | smix8 <52464204+smix8@users.noreply.github.com> | 2022-06-23 17:32:07 +0200 |
commit | fdea2698053b616d0805ef3c4501a76945ce82ef (patch) | |
tree | 26f0b6244c733ae8b9c6965f4c50f631009ad5a6 /modules/navigation | |
parent | c18d0f20357a11bd9cfa2f57b8b9b500763413bc (diff) |
Add NavigationServer map_force_update() function
Adds map_force_update() function to NavigationServer. This function immediately flushes the Navigationserver command queue and recalculates all navigationmeshes and region connections for a specific map.
Diffstat (limited to 'modules/navigation')
-rw-r--r-- | modules/navigation/godot_navigation_server.cpp | 9 | ||||
-rw-r--r-- | modules/navigation/godot_navigation_server.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp index 2f8cb6c230..f661d82ed7 100644 --- a/modules/navigation/godot_navigation_server.cpp +++ b/modules/navigation/godot_navigation_server.cpp @@ -580,6 +580,15 @@ void GodotNavigationServer::flush_queries() { commands.clear(); } +void GodotNavigationServer::map_force_update(RID p_map) { + NavMap *map = map_owner.get_or_null(p_map); + ERR_FAIL_COND(map == nullptr); + + flush_queries(); + + map->sync(); +} + void GodotNavigationServer::process(real_t p_delta_time) { flush_queries(); diff --git a/modules/navigation/godot_navigation_server.h b/modules/navigation/godot_navigation_server.h index d931dbaee0..8f575c904e 100644 --- a/modules/navigation/godot_navigation_server.h +++ b/modules/navigation/godot_navigation_server.h @@ -108,6 +108,8 @@ public: virtual Array map_get_regions(RID p_map) const override; virtual Array map_get_agents(RID p_map) const override; + virtual void map_force_update(RID p_map) override; + virtual RID region_create() const override; COMMAND_2(region_set_enter_cost, RID, p_region, real_t, p_enter_cost); |