Posted: 15th Jan 2022 20:27
These 2 lerp routines ...

+ Code Snippet
function Lerp( startValue as float, endValue as float , value as float )
    result# = ((1.0 - value) * startValue) + (value * endValue)
endfunction result#

function Lerp2(start_value as float , end_value as float , pct as float)
    result# = (start_value + (end_value - start_value) * pct)
endfunction result#


both work great but the simple logic of linearly interrelating without easing is just eluding me ...
Posted: 15th Jan 2022 21:04
Calculate it at the start and use that value. Don't calculate it every step
Posted: 15th Jan 2022 21:08
Why use your own lerp function when AppGameKit has them built in?
CreateCustomTween()
SetCustomTweenFloat1(tweenID, from, to, TweenLinear()
Posted: 16th Jan 2022 18:20
Your functions are linear (at least I know the 2nd one is as it's the formula I use). It looks like you might be changing your start_point to be the unit's position every frame? You'll need to keep the start_point and end_point static and move your pct param from 0 to 1 over the amount of time you want it to take to get from A to B.
Posted: 16th Jan 2022 18:37
Thanks for the help guys, I was sure those functions were supposed to be linear and I guess they are if used correctly, silly mistake there on my part I only had to move 3 lines of code to make it work! lol