Quantcast
Channel: Answers by "Peter G"
Viewing all articles
Browse latest Browse all 90

Answer by Peter G

$
0
0
The general equation for linear interpolation is your second one. Output = (1 - t) * Input1 + t * Input2 It can nicely be expanded to higher degrees (see Bezier curves) and vectorized. Just treat the vector as a collection of parallel interpolations. As to why your value is slightly off, your `Time.deltaTime` for the first frame was probably just a little faster than 20ms. Really I wound't focus that much on it unless you need exactly 8%. If you need to calculate `t`, then Unity has a built-in fuction for that: t = Mathf.InverseLerp ( Input1 , Input2 , Output); and the actual calculation for that looks something like: t = (Output - Input1) / (Input2 - Input1)

Viewing all articles
Browse latest Browse all 90

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>