Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// see https://www.gamasutra.com/blogs/ScottLembcke/20180404/316046/Improved_Lerp_Smoothing.php
public static double LerpWithDeltaTime(double a, double b, double deltaTime, double rate)
{
return Lerp(b, a, Math.Pow(2, -rate * deltaTime));
}
// see https://www.gamasutra.com/blogs/ScottLembcke/20180404/316046/Improved_Lerp_Smoothing.php
public static float LerpWithDeltaTime(float a, float b, float deltaTime, float rate)
{
return Lerp(b, a, Math.Pow(2, -rate * deltaTime));
}
@slembcke

This comment has been minimized.

Copy link

@slembcke slembcke commented Apr 13, 2018

Just use Mathf.Exp(). The exponent doesn't really matter. You'll just end up with a different rate value (which is hand tuned anyway), and Exp() is almost definitely faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment