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.
This commit is contained in:
Hugo Locurcio 2021-02-21 17:55:54 +01:00
parent 4b9b9ed2f2
commit aacaad5066
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
5 changed files with 26 additions and 1 deletions

View file

@ -81,6 +81,9 @@ void CircleShape2D::draw(const RID &p_to_rid, const Color &p_color) {
Vector<Color> col;
col.push_back(p_color);
VisualServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col);
VisualServer::get_singleton()->canvas_item_add_polyline(p_to_rid, points, col, 1.0, true);
// Draw the last segment as it's not drawn by `canvas_item_add_polyline()`.
VisualServer::get_singleton()->canvas_item_add_line(p_to_rid, points[points.size() - 1], points[0], p_color, 1.0, true);
}
CircleShape2D::CircleShape2D() :