Hi,
Can anyone explain how and when does one use InverseLerp ?? I understood Lerp and its usage but i am not able to understand when should one use InverseLerp ??
Hi,
Can anyone explain how and when does one use InverseLerp ?? I understood Lerp and its usage but i am not able to understand when should one use InverseLerp ??
I was a bit confused looking at the docs just now, because the explanation is rather terse. But it actually does exactly what it suggests - instead of returning a value between A and B correspondin to the lerping parameter, it returns the lerping parameter if you feed it the value between A and B.
I guess you could use it for a Slider value or something similar: if you know the lowest possible point of your slider is minPixels
, and the highest possible point is maxPixels
, the value returned by
Mathf.InverseLerp(minPixels, maxPixels, currentPixelPositionOfSlider);
is just the “percentage” (in the range between 0…1) of how much your slider is “full”.
I know it’s not the right place to ask but can you please explain me what is mathf.lerp and how does it work, plz