Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

chryan
Copy link

@chryan chryan commented Aug 15, 2024

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.

@chryan chryan requested review from a team as code owners August 15, 2024 05:44
@Chaosus Chaosus added this to the 4.x milestone Aug 15, 2024
@Calinou
Copy link
Member

Calinou commented Aug 15, 2024

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).

@chryan
Copy link
Author

chryan commented Aug 16, 2024

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.

@Zireael07
Copy link
Contributor

You opened a discussion (which is for proposals without code) instead of a proposal in the repo.

@chryan
Copy link
Author

chryan commented Aug 16, 2024

You opened a discussion (which is for proposals without code) instead of a proposal in the repo.

My bad, I just changed that. Thanks.

@chryan chryan requested a review from a team as a code owner August 18, 2024 01:43
doc/classes/Line2D.xml Outdated Show resolved Hide resolved
@chryan
Copy link
Author

chryan commented Oct 10, 2024

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.

@KoBeWi
Copy link
Member

KoBeWi commented Oct 10, 2024

Run doctool

@chryan chryan requested review from a team as code owners October 16, 2024 05:08
doc/classes/Line2D.xml Outdated Show resolved Hide resolved
doc/classes/Line2D.xml Outdated Show resolved Hide resolved
chryan and others added 2 commits December 5, 2024 00:26
Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants