summaryrefslogtreecommitdiffstats
path: root/scene/resources/convex_polygon_shape_2d.cpp
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-01-20 15:42:11 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2021-02-20 00:00:03 +0100
commit23a1f616fd6c1cdb60b06d4f6e2411ad8ea0f7c2 (patch)
treec41fbd026978bda95b41472a06648705f986be33 /scene/resources/convex_polygon_shape_2d.cpp
parent7447af265b3b9bb880329b913c40cb03aaa89cd7 (diff)
downloadredot-engine-23a1f616fd6c1cdb60b06d4f6e2411ad8ea0f7c2.tar.gz
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.
Diffstat (limited to 'scene/resources/convex_polygon_shape_2d.cpp')
-rw-r--r--scene/resources/convex_polygon_shape_2d.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp
index b4b200a7ff..7271614995 100644
--- a/scene/resources/convex_polygon_shape_2d.cpp
+++ b/scene/resources/convex_polygon_shape_2d.cpp
@@ -75,6 +75,9 @@ void ConvexPolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) {
Vector<Color> 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 ConvexPolygonShape2D::get_rect() const {