#Geometry2D clip_polygons not clipping?
19 messages · Page 1 of 1 (latest)
This is the code that generates the PackedVector2Array
what i noticed is that it does work when offset.
It does not work when the Polygon is in the other polygon though
which sucks a lot because this is what i want to do
godot is cruel software
i love it but right now its hurting me deeply
this is interesting but they use navigation stuff kinda weird
i dont quite get it
its pretty much my issue with a very whacky solution
and its not even godot4
im about to give up 😭
Yeah no way to achieve this in godot without foul tricks. Im done.
It does not work because Polygon2D converts a single outline to a triangulated mesh for rendering. If you do this clip op you get 2 outlines, one for the outer bound and one for the inner "hole" bound. Both are useless for rendering, physics, navigation ... they need to be converted to a polygon mesh. That is e.g. what the linked issue does for navigation mesh.
meshes can not define "holes", what they really do is that they are build out of many polygons that are arranged around that "hole". You can use the triangulate functions and the convex partitioning for that. E.g. cut your outlines in half and turn each half into a functional mesh. If you combine both halfs again you have your "polygon with hole". You can add all the vertices of the polygons to the "polygon" property of the Polygon2D and the then the individual polygon indices arrays to the "polygons" property and it will render them.