Count to Zero in Both directions

Hi, i got some problems with a float.

Sometimes this float is Negative ore Positive, how can i count him back to Zero over time?

Is there something like Mathf.SmoothBackToZero?

Quick help will be nice :wink:
Thank you

You can just Mathf.lerp a value towards zero. But because this scales towards, as you get closer to 0, the same value of t will move slower than when the value is further away.

Then there’s also Mathf.MoveTowards, which does a certain amount of change each time, no matter what, with out passing the end result.

1 Like

Ow thank you

It works fine! thank you :slight_smile:

Is there a Reverse Lerp?
I mean Starting Slow and ends Fast?

Edit:
I did it like,

ReverseLerp = Mathf.MoverTorwards(ReverseLerp, 0f, magicalTime);

if (thisMagicalBool)
   magicalTime += time.deltaTime