Lerp does not work with timeline

i wouldn’t say current location in this case, its more of a start and end location that need to be static. current makes it sound like the variable needs to be updated.

the issue with using non static vectors for the lerp is that the locations are updated each time the timeline updates which will cause a inconsistency resulting in a exponential acceleration of sorts. for example if you were to use your current setup: at time 0.5 the output vector should be halfway between point a and b, but since your updating the start location the lerp will constantly be trying to use the location between the actors current location and the end point, so if at time 0.5 your actor is already half way to the end then the lerp will try to output a location 3/4 the way to the end. hmmm its hard to explain.

maybe it would be better to explain another way. lets use a static alpha of 0.5 and locations 0 and 10. if you have static locations for A & B then your actor would stay in one spot (location 5) between A & B right. but in your case due to the get node you would be getting a location that changes each time like this: for the first time its run the output location is 5 as it should, but then we set location A to the actor location which is 5, then we run the update again (get point 0.5 between a & b) now its 7.5 and we set the actor to that location, the third time we set A again it will return 8.75, etc. your basically removing 50% of the distance to the goal each update instead of remaining stationary. in the actual script you have your removing alpha percent per update. so if you updated 4 times total it would remove 25%, 50%, 75%, 100% resulting in locations (2.5, 6.25, 9.06, 10) instead of (2.5, 5, 7.5, 10).

Bottom line is when using a timeline with a lerp use static values for the A & B pins. So get your initial values, save them to variables, then use the variables as the A & B values. And don’t change the variables while the timeline is running.

2 Likes