As the title suggest, I want to create user define function like Mathf.Lerp.
I want same functionality implementation as like Mathf.Lerp has.
I know Unity already provide this functionality but I want to create it for other game platform and want to achieve same functionality.
So what coding strategy behind this function I have to use??
Lerp is a static function which works like that
public static float Lerp (float from, float to, float t)
{
return from + (to - from) * Mathf.Clamp01 (t);
}
Clamp01 is also a static function which works like that
public static float Clamp01 (float value)
{
if (value < 0f)
{
return 0f;
}
if (value > 1f)
{
return 1f;
}
return value;
}
Issah
August 7, 2014, 10:21am
3
Hi,
i past my answer from an other subject in accord with Siddhartha :
Lerp mean linear interpolation :
In mathematics, linear interpolation is a method of curve fitting using linear polynomials to construct new data points within the range of a discrete set of known data points.
If the two known points are given by the coordinates
(
x
0
,
y
0
)
{\displaystyle (x_{0},y_{0})}
and
(
...
If you want a regular curve its an affine function like ax + b
I think you want a curve like a log, fast at start and slower with time, and when you’r close to the wanted value you stop your Roulette (cause Log never reach the final value) :
In mathematics, the logarithm is the inverse function to exponentiation. That means that the logarithm of a number x to the base b is the exponent to which b must be raised to produce x. For example, since 1000 = 103, the logarithm base 10 of 1000 is 3, or log10 (1000) = 3. The logarithm of x to base b is denoted as logb (x), or without parentheses, logb x, or even without the explicit base, log x, when no confusion is possible, or when the base does not matter such as in big O notation.
The l...
Mathf is an unity class which provide manny function to calcultate this type of curve :
You can find the function of the log, manny graph and other mathematical usefull information :
In mathematics, the Taylor series or Taylor expansion of a function is an infinite sum of terms that are expressed in terms of the function's derivatives at a single point. For most common functions, the function and the sum of its Taylor series are equal near this point. Taylor series are named after Brook Taylor, who introduced them in 1715. A Taylor series is also called a Maclaurin series when 0 is the point where the derivatives are considered, after Colin Maclaurin, who made extensive use...
I hope it will help.