How to have a pickup fly towards the player?

I am doing a health orb, which i want to spawn after an enemy is killed. So my question is, how would i interpolate the movement from point a to point b? Point a being, where the orbs spawn, point b, being where my player is. As i currently have it, the orb moves to the location of the player, but its all happening so fast. I would like the orb to slowly start moving, and then pickup the speed.

Hey,

You might want to try using a Timeline in your Blueprint too so that it always gets the player’s location as the example you’ve posted would only get the player’s current location and would move the pickup to that location.

Give something like this a shot:

Then you could destroy the pickup when it overlaps ONLY the player:

You’ll have to play with the VInterpTo’s Interp Speed and the Timeline’s length (which is using a Vector Track) as if the movement is too slow on the VInterp, the player could outrun the pickup or if the Timeline is too short, it will stop updating before reaching the destination (I suppose as a fail safe upon finishing the timeline you could Teleport the pick up the player if they are running around away from the pickup but it shouldn’t come to that point).

Have fun!

-W

1 Like

Thank you for taking the time to answer my question, i have yet a few more questions. Where did you get “OnActorBeginOverlap(TriggerSphere1)” and The movement node? I cant seem to get that on my blueprint.

Also, i noticed that you were calling “Shape_Sphere” which says its from the persistent level. Does that mean that the mesh was placed within the level and called up in the class blueprint for the health orb? Im still learning this stuff, hehe.

Hey,

The OnActorBeginOverlap(TriggerSphere1) node, is a Trigger Volume that I placed in the level and the “movement” node, is a Timeline (which I named as movement). You are correct about “persistent level” as I did this to show how to use VInterpTo and it was easier to set it up in the Level Blueprint.

In your case, where you want to spawn the object after an enemy dies, you would probably need to create the OnActorBeginOverlap trigger in your pickup Blueprint (which would be called to spawn when your enemy dies).

Check out the Content Examples and the Level_Scripting map. Under section 1.3 there is an example of a coin that is spawned when entering a trigger volume, when getting near the coin it flies into the player character (not exactly what you are after but will give you more of an idea as well).

-W

Awesome! Thank you so much! :slight_smile:

Raparicio, if you add a box(or w/e) to the components of a BP, in the details section, you can scroll down and see “add event” next to a little +. if you click the add event, a list of events that can be added to the event graph will open up. click the event you want to add and it will automatically be added to the event graph. this is really the only way that such events can be added to the graph, as they are not available from right clicking, or dragging off from a node referencing the box.