summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scene/2d/navigation_region_2d.cpp13
-rw-r--r--scene/2d/navigation_region_2d.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index 4a434fa3f8..5510b59903 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -177,6 +177,7 @@ void NavigationRegion2D::_notification(int p_what) {
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || NavigationServer2D::get_singleton()->get_debug_enabled()) && navigation_polygon.is_valid()) {
_update_debug_mesh();
_update_debug_edge_connections_mesh();
+ _update_debug_baking_rect();
}
#endif // DEBUG_ENABLED
} break;
@@ -659,3 +660,15 @@ void NavigationRegion2D::_update_debug_edge_connections_mesh() {
}
}
#endif // DEBUG_ENABLED
+
+#ifdef DEBUG_ENABLED
+void NavigationRegion2D::_update_debug_baking_rect() {
+ Rect2 baking_rect = get_navigation_polygon()->get_baking_rect();
+ if (baking_rect.has_area()) {
+ Vector2 baking_rect_offset = get_navigation_polygon()->get_baking_rect_offset();
+ Rect2 debug_baking_rect = Rect2(baking_rect.position.x + baking_rect_offset.x, baking_rect.position.y + baking_rect_offset.y, baking_rect.size.x, baking_rect.size.y);
+ Color debug_baking_rect_color = Color(0.8, 0.5, 0.7, 0.1);
+ draw_rect(debug_baking_rect, debug_baking_rect_color);
+ }
+}
+#endif // DEBUG_ENABLED
diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h
index e9387376cb..87c2365b15 100644
--- a/scene/2d/navigation_region_2d.h
+++ b/scene/2d/navigation_region_2d.h
@@ -58,6 +58,7 @@ class NavigationRegion2D : public Node2D {
private:
void _update_debug_mesh();
void _update_debug_edge_connections_mesh();
+ void _update_debug_baking_rect();
void _navigation_map_changed(RID p_map);
void _navigation_debug_changed();
#endif // DEBUG_ENABLED