All Questions

Community

A
Chief A

Lerp method solution

Ok, in the acceleration and deceleration part, I solve it using the lerp method, but I would like to know if using that function compared to your solution has any performance disadvantages or if it's ok. Is there a problem using linear interpolation in this case or something like that? Thanks again.
  • Nathan Lovato replied

    It's not a performance issue, but lerp can have other problems, like the fact that you don't control the deceleration precisely. If you also use factor * delta as a lerp factor your lerp effect will be imprecise. You need to use (1 - factor ^ delta) instead: https://www.construct.net/en/blogs/ashleys-blog-2/using-lerp-delta-time-924

    The most important issue though is how you don't control the precise deceleration in pixels / second ^ 2, you can't directly tweak the deceleration property and test the result instantly.