Hi there. I’m trying to smoothly teleport between the pawn’s current position and the target position.
If I just teleport – move to the target position – then I have no problems. When I use the vector lerp, though, I get some unexpected motion that makes me believe that, even though I’m sending data from a linear timeline curve, the lerped values are not linear. There seems to be some sort of bow in the motion.
Here is a picture of the Blueprint and timeline I’m using to get the movement values:
I’ve thought about using vinterp, but I don’t want the motion timing to be FPS dependent.
Am I using vector lerp correctly?
Any suggestions on alternate methods or how to fix this problem?
maybe I didn’t get it right, but according to my understanding a lerp will give you the position between two vectors on a direct line depending on 0 for start until 1 for end.
As to what it seems to me you are moving said starting point all the time.
Shouldn’t that point be static?
Otherwise you will move way faster then expected, since the line between the two points will get shorter yet the value higher.
The first time he takes 10% of a path of the given length of 100m → 10m movement
But then your path will eb shorter by these 10m, therefore 90m in total. Yet your movement value went up to lets say 20% → 20% of 90m = 18m → 18m movement.
Next iteration you’ll have 72m left and 30% → 21.6m movement, …
I think you get it from here on
So my suggestion would be to save the target and the start location as variables and work with them instead of calculating them new every time.
Plus what I just noticed: since you add the target to the current your target will move all the time as well?!
I also just noticed that on the one side you are using relative location and on the other side the world location, you shouldn’t mix them
Converting the connections to variables did the trick! Thanks for that. I was so convinced that once you put a value into the lerp that it used those values for the entirety of its iteration – assuming that it was a closed system after you passed those initial values. Apparently, that isn’t the case and now, with your help, I know better. Thanks again, Chownas.
Nice to hear that worked!
Could you please mark my answer as accepted?