Best way to move actor towards actor over time

Hey there! It’s me again with another question. I have been getting used to blueprints, and am slowly learning it’s caveats and benefits.

I am working on something I consider somewhat simple, but haven’t quite figured out yet.

I have an object (right now, it’s just a sphere on the ground), that has onbegincomponentoverlap event on it. It’s setup to only happen when the actor overlapping it is the player.

I am trying to make it so that when the player overlaps the sphere collider of the ‘object’, it slowly moves the object towards the player, and then once it reaches it destroys itself.

I ended up settling on ‘SetWorldLocation’ on the ‘sphere’ with a vinterp to from the current location to the target location (players spine_03 bone location). In doing so, the object doesn’t appear to move, it just ‘teleports’ there.

Additionally, I cannot figure out how to make the ‘delta time’ and ‘interp speed’ calculated based on the distance from the player the sphere is.

is there a better way to do this? I am trying to make this work similar to how the nuts and bolts work on Ratchet and Clank where if you are within a certain distance of them, they fly towards the player and then destroy themselves once they reach the player (regardless of how far away the player is).

I am trying to make this work similar
to how the nuts and bolts work on
Ratchet and Clank where if you are
within a certain distance of them,
they fly towards the player and then
destroy themselves once they reach the
player (regardless of how far away the
player is).

Something like thia is normally done with with particles (for performance & artsy reasons) so you’d need to look at Niagara - vast topic.

Best way to move actor towards actor
over time

But since we’re talking actors and you will need interpolation for many other things anyway, consider experimenting with something along the lines of:

This is basic interpolation where we try to reach a value over time; here the value is the player’s position. So every frame we’re getting closer and closer. There are plenty of methods to play with this. Curves, easing functions, homing projectiles…

Image from Gyazo

Do tell if any of this makes sense.

@ex0r: also, as you can see, there will be as many methods as there are people!

Works like a charm!

Thank you for the info. Very useful.

You can do it like this:

341783-approach.gif