0
Answered

Anyone have a good lerp macro?

NeedsLoomis 2 years ago updated by Elin 1 year ago 9

Having trouble wrapping my head around that one in visual code!

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Pending Review

What do you mean by lerp? Do you want to tween between two values over a certain amount of time?

Exactly.  Something simple like 

        while(timePassed < lerpTime)
        {
            someVariable = Mathf.Lerp(startingValue, finalValue, timePassed / lerpTime);
            timePassed += Time.DeltaTime;
        }
Answered

In v.1.4, every property and variable will be tweenable with a simple node. Until then, you can do exactly this with graph variables and the update node in a macro!

I don't have time to make a full example right now, but it could look like:


Here's how I would setup the input/outputs:


In v.1.4, every property and variable will be tweenable with a simple node. Until then, you can do exactly this with graph variables and the update node in a macro!

Heyyyy, that'll be super useful.  Thanks for the suggestion too!

Already uploaded FloatTo with a wrapper if you used DOTween which is free and excellent.  Nothing custom using my own math. I also have ColorTo and Vector3To which I haven't uploaded.

And if you are looking for speed based, it's quick to change that. There is just one node to add, SetSpeedBased. Clamp the current value if you want an integer. Something else more specific you need?

Nice, Ill check it out!

we can´t do this with your nodes? i´m trying with lerp node but nothing happens.

I made a little Lerp/Slerp Macro, because i don't want to import a 3rd party tweening asset everytime, when i just want to do a little test/prototype.

https://support.ludiq.io/communities/5/topics/1609-vector3-lerp-slerp-macro