-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
CanvasItem.draw_polyline draws incorrect, distorted geometry #16466
Comments
It doesn't look like a bug, when you think about it. You would need to expand those corners so that the segment has the same thickness, however it can lead to infinitely sized turns in some cases. It looks like |
This is a fundamental problem of the idea used in the function ("replace every point by two points"). If there is a very small angle at some point, the replacement points either extend far into outer space or the lines attached to this corner are very thin. However, you can use three points (one for the inner corner, two for the outer almost-180°-"bend") to reduce these problems to sane levels. After that, there might be some adjustments to make, depending on whether you want to keep the directions (in which case the original vertices might get cut off) or the points (in which case you have to move the above construction "outwards", changing the direction of the lines). It's similar to planning a racetrack using the points as guidance for the straight segments vs. fitting a racetrack through the given points (or, Bézier curves vs. splines; in the sense that Bézier curves need not hit the intermediate points). |
Yeah other method for smooth lines should be used. |
@Chaosus what do you mean? There is no fix planned? Should users just use |
Yeah, I suspect Line2D is better choise |
But it's not if you want custom draw (note that the Line2D node actually uses a LineBuilder, which can also be used as implementation for draw_polyline, not sure why it wasn't done) |
Zylann, got it, should I reopen this ? |
Yeah, although it's possible to use LineBuilder with some predefined params to get a better looking line, I wonder why it wasn't used in the first place ( |
May be improved in 3.2 |
Redirected from #34073 being archived as a duplicate. Godot version: OS/device including version: Issue description: Steps to reproduce:
Minimal reproduction project: |
Wanted to open a bug report but seeing this, so attaching my own reproduction project. GLES2, GLES3, Godot 3.2.4 beta.
|
This is fixed as of 4.0.rc2, closing. Updated MRP: draw_polyline_malformed_1.zip |
I'm observing the same thing as @ComputerErika using 4.2.1 |
Godot version:
cbdd410
Issue description:

the problem is inside
godot/servers/visual/visual_server_canvas.cpp
Line 464 in cbdd410
Minimal reproduction project:
PolylineBug.zip
The text was updated successfully, but these errors were encountered: