summaryrefslogtreecommitdiffstats
path: root/scene/resources/capsule_shape_2d.cpp
diff options
context:
space:
mode:
authorAnilforextra <anilforextra@gmail.com>2022-01-22 22:14:41 +0545
committerAnilforextra <anilforextra@gmail.com>2022-01-22 22:14:41 +0545
commit70b0b2f164fd7c9ca6a3d7c3c2f485b6fb0dad9c (patch)
tree6658486483ac0fe54786e21f10e81955f519b2f3 /scene/resources/capsule_shape_2d.cpp
parent846c14eee9bad75f31df94f7072331e85d24cff5 (diff)
downloadredot-engine-70b0b2f164fd7c9ca6a3d7c3c2f485b6fb0dad9c.tar.gz
Circle&CapsuleShape2D: Fix outlines missing line.
Diffstat (limited to 'scene/resources/capsule_shape_2d.cpp')
-rw-r--r--scene/resources/capsule_shape_2d.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp
index cb8a189116..4d2698d27d 100644
--- a/scene/resources/capsule_shape_2d.cpp
+++ b/scene/resources/capsule_shape_2d.cpp
@@ -84,13 +84,11 @@ real_t CapsuleShape2D::get_height() const {
void CapsuleShape2D::draw(const RID &p_to_rid, const Color &p_color) {
Vector<Vector2> points = _get_points();
- Vector<Color> col;
- col.push_back(p_color);
+ Vector<Color> col = { p_color };
RenderingServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col);
if (is_collision_outline_enabled()) {
+ points.push_back(points[0]);
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);
}
}