Hi all, bit of a newbie question here. I want to use a FMath::VInterpTo to move actor from point A to point B. The thing is I dont want to do this to be in the tick function but rather a static function I can expose as a blueprint node.
I’ve tried using a while loop but the deltatime will not change for the VInterpTo how would I write this. A the moment I have the following.
A while loop doesn’t make sense here because the loop will block everything else from happening until the interpolation is complete, so it will just look like the object “snaps” to the target position anyway. Loops don’t run in parallel.
Also, the loop will get stuck forever because NewLocation is never being updated to anything.
The Lerp and VInterpTo functions are already exposed to Blueprint - the VInterp is designed to be used over a period of several frames, which is why you typically call them from tick and why the VInterp functions take a delta time. You can call them from a timer I guess, but they won’t neccesarily be called at even intervals and you’ll get stepping.
In blueprints you could use a Timeline node. They’re quite a lot better than tick nodes for simple procedural animation. That sounds like it’d be difficult in C++ though.
I meant OP A timeline would work also yeah, but since it’s for movement I’m not sure that’s what they want… not sure. Timelines in C++ are wierd anyway, they’re best used in BP IMO.
Ticking an actor costs very little on it’s own - it’s what you do in the tick that matters. This is exactly the kind of thing it’s meant for. Even timelines are ticking actor components under the hood.
Tick being the source of ‘bad performance’ is a silly myth that seems to have taken root.