-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Convex decomposition fails for offset_polyline of simple Curve2D #91607
Labels
Comments
Confirmed the same issue (as the v4.3.dev6 version) exists in the upstream project |
The issue appears to be that the offset_polyline generates quite a lot of duplicate points that decompose_polygon_in_convex does not handle well. If I remove the duplicate points then the issue goes away. |
This was referenced May 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested versions
System information
Godot v4.2.2.stable unknown - Arch Linux #1 SMP PREEMPT_DYNAMIC Thu, 02 May 2024 17:49:46 +0000 - Wayland - Vulkan (Mobile) - dedicated AMD Radeon RX 6600 (amdgpu) - Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz (16 Threads)
Issue description
In the project below I generate a Curve2D of two points and generate a polygon using offset_polyline with width 5.
If I then try to decompose that polygon with decompose_polygon_in_convex or assign it to a CollisionPolygon2D I see the error below on the terminal console and and no decomposition is created. This also means that no collisions will be possible from the CollisionPolygon2D.
Lines 18 and 19 in the attached project are the lines that trigger the error.
There are four curves that are tested in the attached project:
0: A curve from 0,0 to 210,-1 (relative to the curve origin)
The inner line shown is the Curve2D and the red outer line is the collision poly outline, note that its area is not coloured.
1: A curve from 0,0 to 200,0. This generates a single decomposition shape which colours the collision poly area red
2: A curve from 0,0 to 200,0. A mirror in x-axis of the zeroth curve.
4: A curve from 0,0 to 200, 200.
Note the great many decomposition polygons.
Interestingly I see different behaviour from the latest release but they fail all the same:
v4.2.2.stable, v4.2.1.stable, v4.1.4.stable - as described above: end_pts 0 and 2 generate no decomposition, 1 and 3 do
v4.3.dev6.official - end_pts 3 generate no decomposition, 0, 1 and 2 do
Steps to reproduce
Here's a simplified function that will reproduce the error. The project adds shows the same problem visually.
on the console (but not the godot output area)
Minimal reproduction project (MRP)
convex_decomp_bug.zip
The text was updated successfully, but these errors were encountered: