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

Expand lerp function to include Transform2D and Transform3D #10579

Closed
TheYellowArchitect opened this issue Aug 27, 2024 · 2 comments
Closed

Expand lerp function to include Transform2D and Transform3D #10579

TheYellowArchitect opened this issue Aug 27, 2024 · 2 comments
Milestone

Comments

@TheYellowArchitect
Copy link

Describe the project you are working on

Online action game with rollback

Describe the problem or limitation you are having in your project

Supported types: int, float, Vector2, Vector3, Vector4, Color, Quaternion, Basis.

It doesn't work with Transform3D and Transform2D. But Transform2D and Transform3D have the following lerp functions which should be invoked for their type:

Transform3D interpolate_with(xform: Transform3D, weight: float)

https://docs.godotengine.org/en/stable/classes/class_transform3d.html#class-transform3d-method-interpolate-with

Describe the feature / enhancement and how it helps to overcome the problem or limitation

It fills a minor oversight of the Variant types valid for this function.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

lerp also includes Transform2D and Transform3D

If this enhancement will not be used often, can it be worked around with a few lines of script?

Yes, by writing your own singleton lerp wrapper class. Not important really, but would make the code cleaner by cutting off 1 class.

Is there a reason why this should be core and not an add-on in the asset library?

it expands an existing engine function

@kleonc
Copy link
Member

kleonc commented Aug 28, 2024

Given that lerp(Variant, Variant) already performs Basis.slerp / Quaternion.slerp (which could be argued to be non-trivial linear interpolations) I see no reason for it to not perform Transform2D.interpolate_with / Transform3D.interpolate_with as well.

So I'd say feel free to open a PR whoever wants to tackle it. Here's relevant source.

@akien-mga
Copy link
Member

Implemented by godotengine/godot#96496.

addmix pushed a commit to addmix/godot that referenced this issue Sep 6, 2024
WhalesState pushed a commit to WhalesState/blazium that referenced this issue Mar 8, 2025
WhalesState pushed a commit to WhalesState/blazium that referenced this issue Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants