Lerping a mesh in a function

I’m trying to move a mesh from one rotation to another, using the Lerp(rotator) node and delta time in a function. What I’m aiming for if for a complete movement, from the StartPosition(local variable) to the EndPosition(local variable). I figured if I stored the current position in a non local variable, it would start from there on the next step in the function.

Any ideas where I’m going wrong?

When you use a lerp node it expects an alpha value between 0 and 1. so 0 will be all input A, 1 will be all input B and 0.5 will be half/half. Delta Time is the time since the last frame so you will be always hovering very close to your A input value.

You need to feed in a changing value from 0 to 1. Try using a timeline to seed a value into your function.

Thanks for your reply, I appreciate it. Is a timeline the only way to increment a value inside a function? I was hoping to get away without the need for timelines.

Well if you call the function once it will only fire once, even if you change the value elsewhere. You need to update and fire the function each tick over the duration of your Lerp. You COULD run the function through your tick and feed values into it but then it may fire unnecessarily and on every frame.

The good thing about a timeline is that it will only fire the function (connect it to the timeline’s update output) while the timeline is playing, so it’s more efficient. You will also have nice control over the curve of the lerp, for example adding ease in and out or having an exponential curve.

Alright cool, I’ll get to it. Thanks for your help, hope you have a great day.