-
-
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
Implement segmenting of Line2D for better fidelity when using width curves #95541
base: master
Are you sure you want to change the base?
Conversation
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. |
My bad, I just changed that. Thanks. |
fa79d4f
to
a919851
Compare
a919851
to
dc8a5a7
Compare
Is this not being reviewed because of the CI failure? |
Run doctool |
Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
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:
line2d-segment-feature.mp4
Curve offset adjusts the sampling position of the curve:
line2d-curve-offset-feature.mp4
You can also animate the curve offset to produce some neat line effects:
line2d-animated.mp4
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.