Quantcast
Viewing latest article 18
Browse Latest Browse All 93

How to lerp with a changing "from" value?

It's possible I'm not even using this right but basically I'm making a hunger system and I'm calling this in fixed update: public void Starve() { if(CurrentHunger > 0) { CurrentHunger = Mathf.Lerp(CurrentHunger, 0, HungerRate * Time.deltaTime); } } In this example, CurrentHunger starts as 100. Hunger rate is 15. My time.deltaTime is 0.02. With this use of lerp, basically, my from value is always changing. So: - 1 second it is 70 - 2 seconds it is 49 - 3 seconds it is 34.3 - 4 seconds its is 24.01 See? It's not decrementing linearly. Am I even using lerp right? And what do I need to do to fix this?

Viewing latest article 18
Browse Latest Browse All 93

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>