• News

• Industries

• Learning & Support

• Community

• Marketplace # Lerp going much faster than it should

I’ve been trying to make a temperature system where every day of the game at 6 and 16 hours the hottest and coldest temperatures are generated respectively, I think I’m close to getting something functional, I’m using a floating curve to get a value that defines the alpha of a lerp but even with this alpha at 0.001 it already reaches the value of B. do I have to divide some value or something?

Hi, one issue you have is that you change what you put into the Lerp. Imagine Alpha is fixed at 0.5. Now you Lerp between for example A = 0 and B = 10. In the first step you get 5 as output as it should based on the alpha. But now since you set A to 5, in the next step you lerp between 5 and 10 with alpha 0.5 and will get 7.5 as result. So if you call your Lerp on tick, then you will converge exponentially fast to B, no matter what your alpha value is.

So instead of putting “Current’c” into A, put something like “Start’c” into it.

1 Like
1 Like