Guillemsc / GTweensGodot

C# tweening library for Godot 4.x
MIT License
180 stars 6 forks source link

Issue with tweening godot vectors #19

Closed gamedevserj closed 4 months ago

gamedevserj commented 6 months ago

Generic tweening doesn't work with Godot's vectors

Vector3 test;
 GTween t = GTweenGodotExtensions.Tween(test, x => test = x, Vector3.One, 1f);

The error is CS0029 where it says that I can't implicitly convert Godot.Vector2I to Godot.Vector3, although Vector2I is not used in my code at all.

Hovering over parameters in tween shows that both test and x are Vector3

Generic tweening of default c# values seems to be working without a problem

Guillemsc commented 6 months ago

Hey, thanks for raising this, I'll investigate and fix.

Guillemsc commented 4 months ago

Hey @gamedevserj, sorry for the delay! The getter (first parameter of the Tween function) is an action, so you need to use it like this:

Vector3 test = Vector3.Zero; // You need to initialize this or there is a compile error
GTween t = GTweenGodotExtensions.Tween(() => test, x => test = x, Vector3.One, 1f);

I'll close this, but don't hesitate to open another issue if I missed something, or it's still not working for you.

gamedevserj commented 4 months ago

Hey @Guillemsc thanks! Can't believe I didn't notice it :facepalm: And no worries about the time!