From 23a1f616fd6c1cdb60b06d4f6e2411ad8ea0f7c2 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 20 Jan 2021 15:42:11 +0100 Subject: Draw an outline for 2D debug collision shapes This makes them easier to distinguish, especially when used in a TileMap. The default color's opacity has been slightly decreased to account for the new outline. --- scene/resources/capsule_shape_2d.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scene/resources/capsule_shape_2d.cpp') diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp index 3725d855f4..acf7319339 100644 --- a/scene/resources/capsule_shape_2d.cpp +++ b/scene/resources/capsule_shape_2d.cpp @@ -85,6 +85,9 @@ void CapsuleShape2D::draw(const RID &p_to_rid, const Color &p_color) { Vector col; col.push_back(p_color); RenderingServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col); + RenderingServer::get_singleton()->canvas_item_add_polyline(p_to_rid, points, col); + // Draw the last segment as it's not drawn by `canvas_item_add_polyline()`. + RenderingServer::get_singleton()->canvas_item_add_line(p_to_rid, points[points.size() - 1], points[0], p_color); } Rect2 CapsuleShape2D::get_rect() const { -- cgit v1.2.3