summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/navigation/3d/godot_navigation_server_3d.cpp6
-rw-r--r--modules/navigation/3d/godot_navigation_server_3d.h1
-rw-r--r--modules/navigation/nav_map.cpp2
-rw-r--r--modules/navigation/nav_map.h2
4 files changed, 11 insertions, 0 deletions
diff --git a/modules/navigation/3d/godot_navigation_server_3d.cpp b/modules/navigation/3d/godot_navigation_server_3d.cpp
index 430d527844..fc96506795 100644
--- a/modules/navigation/3d/godot_navigation_server_3d.cpp
+++ b/modules/navigation/3d/godot_navigation_server_3d.cpp
@@ -1298,6 +1298,7 @@ void GodotNavigationServer3D::process(real_t p_delta_time) {
int _new_pm_edge_merge_count = 0;
int _new_pm_edge_connection_count = 0;
int _new_pm_edge_free_count = 0;
+ int _new_pm_obstacle_count = 0;
// In c++ we can't be sure that this is performed in the main thread
// even with mutable functions.
@@ -1315,6 +1316,7 @@ void GodotNavigationServer3D::process(real_t p_delta_time) {
_new_pm_edge_merge_count += active_maps[i]->get_pm_edge_merge_count();
_new_pm_edge_connection_count += active_maps[i]->get_pm_edge_connection_count();
_new_pm_edge_free_count += active_maps[i]->get_pm_edge_free_count();
+ _new_pm_obstacle_count += active_maps[i]->get_pm_obstacle_count();
// Emit a signal if a map changed.
const uint32_t new_map_iteration_id = active_maps[i]->get_iteration_id();
@@ -1332,6 +1334,7 @@ void GodotNavigationServer3D::process(real_t p_delta_time) {
pm_edge_merge_count = _new_pm_edge_merge_count;
pm_edge_connection_count = _new_pm_edge_connection_count;
pm_edge_free_count = _new_pm_edge_free_count;
+ pm_obstacle_count = _new_pm_obstacle_count;
}
void GodotNavigationServer3D::init() {
@@ -1566,6 +1569,9 @@ int GodotNavigationServer3D::get_process_info(ProcessInfo p_info) const {
case INFO_EDGE_FREE_COUNT: {
return pm_edge_free_count;
} break;
+ case INFO_OBSTACLE_COUNT: {
+ return pm_obstacle_count;
+ } break;
}
return 0;
diff --git a/modules/navigation/3d/godot_navigation_server_3d.h b/modules/navigation/3d/godot_navigation_server_3d.h
index 5ba7ed1088..12a1132f07 100644
--- a/modules/navigation/3d/godot_navigation_server_3d.h
+++ b/modules/navigation/3d/godot_navigation_server_3d.h
@@ -95,6 +95,7 @@ class GodotNavigationServer3D : public NavigationServer3D {
int pm_edge_merge_count = 0;
int pm_edge_connection_count = 0;
int pm_edge_free_count = 0;
+ int pm_obstacle_count = 0;
public:
GodotNavigationServer3D();
diff --git a/modules/navigation/nav_map.cpp b/modules/navigation/nav_map.cpp
index f917c988ea..9796fa350d 100644
--- a/modules/navigation/nav_map.cpp
+++ b/modules/navigation/nav_map.cpp
@@ -907,6 +907,7 @@ void NavMap::sync() {
int _new_pm_edge_merge_count = pm_edge_merge_count;
int _new_pm_edge_connection_count = pm_edge_connection_count;
int _new_pm_edge_free_count = pm_edge_free_count;
+ int _new_pm_obstacle_count = obstacles.size();
// Check if we need to update the links.
if (regenerate_polygons) {
@@ -1219,6 +1220,7 @@ void NavMap::sync() {
pm_edge_merge_count = _new_pm_edge_merge_count;
pm_edge_connection_count = _new_pm_edge_connection_count;
pm_edge_free_count = _new_pm_edge_free_count;
+ pm_obstacle_count = _new_pm_obstacle_count;
}
void NavMap::_update_rvo_obstacles_tree_2d() {
diff --git a/modules/navigation/nav_map.h b/modules/navigation/nav_map.h
index d6215ea57f..3dd6db21dd 100644
--- a/modules/navigation/nav_map.h
+++ b/modules/navigation/nav_map.h
@@ -123,6 +123,7 @@ class NavMap : public NavRid {
int pm_edge_merge_count = 0;
int pm_edge_connection_count = 0;
int pm_edge_free_count = 0;
+ int pm_obstacle_count = 0;
public:
NavMap();
@@ -216,6 +217,7 @@ public:
int get_pm_edge_merge_count() const { return pm_edge_merge_count; }
int get_pm_edge_connection_count() const { return pm_edge_connection_count; }
int get_pm_edge_free_count() const { return pm_edge_free_count; }
+ int get_pm_obstacle_count() const { return pm_obstacle_count; }
private:
void compute_single_step(uint32_t index, NavAgent **agent);