Download

[beginner] Interacting with my object

Hi, im kinda new in UE4 and I need to do something that may be simple for you but hell for me… In my game prototype, I have severals ball that spawn and I want to create a function that when I press the key E (or any key in fact its doesnt really matter for now) the ball will ‘fly’ midair to my character and follow him, like hes holding it but withouth the animation (that’ll come later) but i have no idea how to do it… thanks very much. Note: I Need to do my function in MainGameMode if it can change anything

Edit : its a 3rd person game

I can forgot the ‘fly in midair’ i just want the ball to follow me when im near to it and press a key and i still have trouble on how to figure it out ;s :frowning:

You can set a key binding action for “E” called “StartFlying” (or whatever). Then bind the “StartFlying” action to a Timer, which calls a new function “FlyToPlayer”. In “FlyToPlayer” you can use “Find Look at Rotation” to take the ball position and the player position, and then use this to move the ball. To actually move the ball, you can use the function “Set Actor Location” to add a delta value toward the player (use “Get Forward Vector” on the result of the balls rotator). You may need to scale this value to get the right motion. Then make sure you clear the timer at the end. While there are probably 15 different ways to do this, maybe this will give you some ideas.

First of all thank you! unfortunatly i’m not sure i can do all that, for now in my event graph I have a ‘’ E node that bind to my ‘PickUp’ function, but for the rest im kinda lost here what i started using what you said fly.png (since its 2 am in EST i will answer tommorow… and yea i know i’m bad :v)

Here is a way to do it:

Ball Bp

c48.PNG

GameMode

b4662a923e5c9e028581be32f216b5f56f7914c0.png

I am interested in this as well. Can anyone alse elaborate on this?

wow thank so much

ball.JPG I still have 2 mini question about it if I understand well… The first BP goes in my ball BP right? and the second maingamemode?

And in the first BP i cant find the thow ‘x’ node, what are they called? and in the second BP why my set player doesnt have the target in it?

Do you know why my last set with go to player cant have a target node ? like in your example, its the only thing I Cant get to test it :’(

you have to drag it from “ArrayElement” (Set “Go To Player”) and your Ball_Bp must have this bool variable inside it

Thanks!! but here what i did : ball2.JPG ball3.JPG and nothing happens ;s do you have an idea? (Urbas is the name of the ball) or maybe im doing it wrong, im facing a ball with my 3rd person character and nothing happens when i press F

in your graph “go to player” is setted to false , set it to true

Yea sorry i took the picture too fast but its already setted to true

and make sure you setted your speed and min distance variables

oops yea i forgot those :v i set my sped to 20 and distance to 200 (maybe i use wrong one?) and still nothing ;s I’m sorry i feel bad

20 cm/sec is a litle small

try speed 200
distance 600

OMG its work thanks so much you are very kind

look at enable input you made a mistake there,

Thank you, its work, i still need to look at some thing but overall my main task is done thanks! (likea way that the ball doesnt leave my character!) thanks very very munch! <3