How to Lerp between Float variables?

How to use lerp for float variables in C++ ?
I know about vector FMath::Lerp but this is not what I need.

float firstvalue = 20.0f;
float secondvalue = 40.0f;
float alpha = 0.5f;
float lerpedvalue = FMath::Lerp(firstvalue, secondvalue, alpha);

lerpedvalue will be 30.0f in this case.
FMath::Lerp is a templated function and will do vectors, rotators, floats as needed.


Thank You very much, really appreciated, You actually solved my big problem )

1 Like