-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polygon2D doesn't render when there are crossed lines #40911
Comments
Yeah the triangulator used to render those polygons in Godot doesn't handle self-intersecting polygons at the moment. See #16423 which can help this perhaps. But currently you can try to pass those polygons vertices through |
@Xrayez : Do I understand you correctly that, as a workaround to find a self-intersecting polygon, one might have to see whether |
Not really, the suggested workaround is that you can just do the merge operation, which does perform polygon simplification under the hood for you, so there's no need to check whether polygon is strictly-simple in the first place, as most of the time (95% of cases), these polygons will be converted to strictly-simple. But yeah, the simplification alone could result in multiple polygons to be returned. I wouldn't rely on this information because there might be other reasons as to why merge operation would result in multiple polygons (say, merging two halves of a donut, now you have both outer and inner polygons). |
Merge... with what? When I have one polygon, and it is self-intersecting...? Do I do |
@Av3r3tt yes, see my first post:
It may work with Technically it wouldn't be a merge, but this is how Clipper library does simplification internally as well. I agree it's not intuitive at the moment, this is why I suggested to add |
When you say EVEN_ODD is used by default, you're talking about the underlying "Clipper" library, right? I don't see a way to specify "NON_ZERO" from the gdscript interface side. |
I would like to point out that Unity3D will remove the offending self-intersection, just the one face/affected edge and still render the rest of the polygon. Unity will also display a warning to the user in the editor. Going further, I think a bigger issue is that transitively the logic is actually broke.
|
Godot version: 3.2.2 (Steam)
OS/device including version: Ubuntu 20.04, Intel HD 3000, GLES2
Issue description: I was doing a project where a player draws shapes as some sort of platforms, and I tried to make a shape that has crossed lines, and it silently fails to render. Some of the shapes do draw though, but I don't really know how to categorize that.
Steps to reproduce:
Here is the video demonstration (in the game, it draws Line2D's first, then when a shape is finished, it replaces with Polygon2D):
https://drive.google.com/file/d/1G5EqbVSwqZp6JxG7KvOMvfNVOelYnbht/view?usp=sharing
The text was updated successfully, but these errors were encountered: