# Make actor follow the player

Hi, I’m new to Unreal and I’m trying to make a soccer game, I made an ‘Actor Blueprint’ of a ball with the necessary physics. The problem is the following:

I want to make it so that when the player gets close enough to the ball, it sticks to his feet so that it gives the feeling that he is running with the ball on his feet. The problem is that I can’t make this happen, if someone can help me I will be eternally grateful.

Maybe you can learn about “Child Actor Component”.

Look this video: UE4 - Football system (Very Early WIP) - YouTube
When the player get the ball, look what happen

If you want an object to approach a location it would probably involve VInterpTo():

FMath::VInterpTo | Unreal Engine Documentation

You need an Frotator with deltatime, first it has to rotate at the angle the player is at. You need the delta time function for motion and Frotator for the object to rotate towards the actor so it points on the X axis towards the player. To track the motion you need to set actor location to the player on the the object (actor) you want to follow the player. It’s a bit complicated since you have to use a tranformation of motion to rotation.

So the idea is you use an Frotator and the Frotator is on the deltatime function. I got my own to do this . You need some speed variable for deltatime.

You also set deltatime on motion so actor location is on the player, meaning it will not teleport you to the player, deltatime function will handle the transition so you don’t instantly teleport into the player with the actor.

With deltatime it will come towards the player if you set actor location on the player, but you need to get the player location on the actor side in the actor’s cpp. I can’t give you the code since I worked on this too much.

The Frotator part is more tricky since you have to transform Rotation into motion for the object to rotate with Delta.

You want the object to rotate towards the player and then move towards it, with animation you can make this seamless, adding animation to it so it does not look robotic.