summaryrefslogtreecommitdiff
path: root/scene/resources/capsule_shape_2d.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-02-20 08:45:28 +0100
committerGitHub <noreply@github.com>2021-02-20 08:45:28 +0100
commitbb13ec98f33af90232d6222c96bdb1a6a44fcfc6 (patch)
tree3c395bb4f816bb957c18904aaa0a8fbfa974f769 /scene/resources/capsule_shape_2d.cpp
parentdc1ae065578baee102d461353c757ebf2cc5cf8c (diff)
parent23a1f616fd6c1cdb60b06d4f6e2411ad8ea0f7c2 (diff)
Merge pull request #34923 from Calinou/debug-collision-shapes-draw-outline
Draw an outline for 2D debug collision shapes
Diffstat (limited to 'scene/resources/capsule_shape_2d.cpp')
-rw-r--r--scene/resources/capsule_shape_2d.cpp3
1 files changed, 3 insertions, 0 deletions
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<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 CapsuleShape2D::get_rect() const {