Implement segmenting of Line2D for better fidelity when using width curves
Currently, your line doesn't render the correct curvature that corresponds with the width curve if the number of points on your line are less than the number of points on your curve.
This fixes that and adds an extra curve_offset property which allows you to do some neat Line2D animations with the curve width (see example videos below).
Segment produce better 'wavey' lines when more curve control points exist than line points:
https://github.com/user-attachments/assets/35a1fe1a-bd1f-4313-bb29-d7d7adb75b57
Curve offset adjusts the sampling position of the curve:
https://github.com/user-attachments/assets/d66792df-39c9-4945-93ab-47e96d49cfcd
You can also animate the curve offset to produce some neat line effects:
https://github.com/user-attachments/assets/e1e2d108-ad7d-4fdd-83b9-3629abf76da2
It's possible for the logic to move into the LineBuilder if it's deemed that that's the better place to implement this feature. I'm just not currently familiar with the math behind how that works so I opted for the simpler solution.
The number of segments corresponds with the curve bake resolution instead of a separate property as I don't see it being very useful to keep those values independent.
Thanks for opening a pull request :slightly_smiling_face:
Feature pull requests should be associated to a feature proposal to justify the need for implementing the feature in Godot core. Please open a proposal on the Godot proposals repository (and link to this pull request in the proposal's body).
Thanks for opening a pull request 🙂
Feature pull requests should be associated to a feature proposal to justify the need for implementing the feature in Godot core. Please open a proposal on the Godot proposals repository (and link to this pull request in the proposal's body).
I'm new to the process and wasn't aware of it, thanks for pointing me in the right direction!
EDIT: I've started a proposal here if anyone's interested in chiming in.
You opened a discussion (which is for proposals without code) instead of a proposal in the repo.
You opened a discussion (which is for proposals without code) instead of a proposal in the repo.
My bad, I just changed that. Thanks.
Is this not being reviewed because of the CI failure? If so, it's failing from what looks like the Linux binary is generating a slightly different order for the documentation in the XML file. This seems a bit arbitrary and I'm not sure how to fix this.
Run doctool