diff options
author | Danil Alexeev <danil@alexeev.xyz> | 2023-01-29 13:07:11 +0300 |
---|---|---|
committer | Danil Alexeev <danil@alexeev.xyz> | 2023-01-29 19:07:09 +0300 |
commit | 5195f723b9c8265b2f6a8befaec84f7965117d90 (patch) | |
tree | 6740b5f1907b8fd1e800d8f9b8ed5ad324ad76df /scene/resources/world_boundary_shape_2d.cpp | |
parent | d01ac9c73686fdf86f083f4d3ee1301bb54d855f (diff) |
Improve stroke drawing on 2D collision shapes
Diffstat (limited to 'scene/resources/world_boundary_shape_2d.cpp')
-rw-r--r-- | scene/resources/world_boundary_shape_2d.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/resources/world_boundary_shape_2d.cpp b/scene/resources/world_boundary_shape_2d.cpp index 49f0873a3e..35cb8ef13d 100644 --- a/scene/resources/world_boundary_shape_2d.cpp +++ b/scene/resources/world_boundary_shape_2d.cpp @@ -76,11 +76,12 @@ real_t WorldBoundaryShape2D::get_distance() const { void WorldBoundaryShape2D::draw(const RID &p_to_rid, const Color &p_color) { Vector2 point = get_distance() * get_normal(); + real_t line_width = 3.0; Vector2 l1[2] = { point - get_normal().orthogonal() * 100, point + get_normal().orthogonal() * 100 }; - RS::get_singleton()->canvas_item_add_line(p_to_rid, l1[0], l1[1], p_color, 3); - Vector2 l2[2] = { point, point + get_normal() * 30 }; - RS::get_singleton()->canvas_item_add_line(p_to_rid, l2[0], l2[1], p_color, 3); + RS::get_singleton()->canvas_item_add_line(p_to_rid, l1[0], l1[1], p_color, line_width); + Vector2 l2[2] = { point + get_normal().normalized() * (0.5 * line_width), point + get_normal() * 30 }; + RS::get_singleton()->canvas_item_add_line(p_to_rid, l2[0], l2[1], p_color, line_width); } Rect2 WorldBoundaryShape2D::get_rect() const { |