godot-docs
godot-docs copied to clipboard
Fix smooth follow example in interpolation
Old method is not really frame-independent. Formula with explanation found from here.
Notice: I tested the code only in 3.x build, then changed linear_interpolation
to lerp
. I think there shouldn't be any other changes between 3.x and 4.0. Also C# code is untested.
Adding link since OP hasn't https://docs.godotengine.org/en/latest/tutorials/math/interpolation.html I tested current implementation in 4.0 beta2, and then tried yours (so I tested both versions)
The version currently at the docs does interpolate evenly but it jitters. Your version is better as its smooth without jitter. I don't like that the code is slightly more complicated (newbies will use it but won't understand it, compared to current version), but the results are worth it imo.
Who can make a call on wether if we merge this or not?