godot icon indicating copy to clipboard operation
godot copied to clipboard

Improve stroke drawing on 2D collision shapes

Open dalexeev opened this issue 2 years ago • 2 comments

  • Thin lines when scaling CollisionPolygon2D.
  • Draw a CollisionPolygon2D stroke on top of the polygon instead of below it.
  • Improve the strokes of RectangleShape2D, CircleShape2D, CapsuleShape2D and ConvexPolygonShape2D. Since we can't control the exact position of the thin lines when scaling (and a line of the same color will be drawn next to the shape, not on top of it), I changed the stroke's alpha channel to 1.

Before:

After:

dalexeev avatar Jan 29 '23 10:01 dalexeev

Drawing the outlines with alpha = 1.0 makes sense to me, looks like improvement.

One reason I made outlines translucent is that you can notice if multiple outlines (from different shapes) are overlapping. It's not essential to do, but it's nice to have to troubleshoot specific issues.

Calinou avatar Jan 29 '23 17:01 Calinou

I don't insist on alpha = 1.0, but the color of the stroke should be noticeably different from the color of the shape, due to the way drawing lines with width < 0 works.

dalexeev avatar Jan 29 '23 17:01 dalexeev

Thanks!

akien-mga avatar Jan 30 '23 09:01 akien-mga