So what I want to do is basically that if my player is near my BP object, the BP Object is supposed to fly towards him and right before it hits my player I want to destroy it. (An example of this would be like how you pickup objects in Minecraft) The problem is I have no idea on how to make it “fly” towards my player. Anyone has an idea?
I would use the tick event on the object. Have a collision box on the object. When a player collides with the collision box, set a target(which will be an actor variable). In the tick, if the target != NULL then you need to do some math. I would use Interp to then gradually move the X Y and Z to the player’s X Y and Z. Then just destroy the local actor.
Edit (Thanks to DG Cage pointing out BPs):
Since you are using Blueprints, you can still use the collision box, however you can use timelines to gradually move the object from one location to another. No need to use the tick event.
So now, on the begin overlap event, begin that timeline using the other actor(which should be a character, cast to character first to check). Use the casted character’s location as the end result.
Depends on what you are working with. For actors they already have the tick enabled, you need to override the tick function and then in the tick function, you must call the parent’s tick.
Even in C++ you would use the overlap event and a timeline. You can set the actor to be able to tick, but i don’t think you will want to turn it on and off everytime.
Best results for gradually moving something come from Timelines. You get a lot of control over exactly what happens to the object, when it starts/stops, and even forward/reverse capabilities. Float, vector, and event outputs are available, and as many as you want, within the same little nifty node.
You can use a float track in the Timeline as the alpha for a Lerp which would do the trick nicely.
And generally, if you have something that needs to operate on every frame but is temporary or event based, Timelines are better for performance and give greater control.
In C++ are you able to simply turn Tick on and off for whatever class its affecting? I’ve gotten proficient with BPs and have been interested in going all the way by learning C++