From 63fe1959657dd49cda722468b460362cd682b16f Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 11 May 2024 19:55:48 +0200 Subject: [PATCH] Implement debug drawing avoidance radius in LayeredTileMapLayer. --- modules/layered_tile_map/layered_tile_map_layer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/layered_tile_map/layered_tile_map_layer.cpp b/modules/layered_tile_map/layered_tile_map_layer.cpp index 002041f97..bcd0cc8ec 100644 --- a/modules/layered_tile_map/layered_tile_map_layer.cpp +++ b/modules/layered_tile_map/layered_tile_map_layer.cpp @@ -1352,6 +1352,7 @@ void LayeredTileMapLayer::_navigation_draw_cell_debug(const RID &p_canvas_item, Color pushout_face_color = Navigation2DServer::get_singleton()->get_debug_navigation_avoidance_static_obstacle_pushout_face_color(); Color pushin_edge_color = Navigation2DServer::get_singleton()->get_debug_navigation_avoidance_static_obstacle_pushin_edge_color(); Color pushout_edge_color = Navigation2DServer::get_singleton()->get_debug_navigation_avoidance_static_obstacle_pushout_edge_color(); + Color debug_radius_color = Navigation2DServer::get_singleton()->get_debug_navigation_avoidance_obstacles_radius_color(); for (int layer_index = 0; layer_index < tile_set->get_avoidance_layers_count(); layer_index++) { bool flip_h = (c.alternative_tile & LayeredTileSetAtlasSource::TRANSFORM_FLIP_H); @@ -1395,6 +1396,13 @@ void LayeredTileMapLayer::_navigation_draw_cell_debug(const RID &p_canvas_item, RS::get_singleton()->canvas_item_add_polyline(p_canvas_item, debug_obstacle_line_vertices, debug_obstacle_line_colors, 4.0); } + + real_t radius = tile_data->get_avoidance_radius(layer_index); + Vector2i position = tile_data->get_avoidance_position(layer_index); + + if (radius > 0.0) { + RS::get_singleton()->canvas_item_add_circle(p_canvas_item, position, radius, debug_radius_color); + } } } }