Hi, I’m trying to make game that player can create polygon in game. The problem is that in some cases player might choose the point that might create intersecting polygon so I want to sort every point in polygon so that every line in polygon is not intersecting each other before creating polygon
var polygons = Geometry2D.merge_polygons($Polygon2D.polygon, PackedVector2Array([]))
which will return an array of polygons, which you could then draw each individually (using their own, separate Polygon2D node) to arrive at the exact shape of the original polygon, not just their convex hull.