Fly object toward player

Hello
I want to fly object toward player when character enter to the collisionbox. I failed to cast bp player to get capsule location. what should i connect to the object pin?

And is there a easier way to to that? i know mine not the best sollution


Hey, you can just add the Object to the event dispatcher as a variable. This way you can use the Object you get from your first cast when simulating physics.

1 Like

Perhaps. Does the collision box belong to the player, to the flying object or is unrelated to any of them? You could try a Projectile Movement component’s Homing feature - that’s providing you must use physics because this behaviour does not require any unless it’s a specific design choice.


Besides that, if you have a Possessed Character, you can always access it like so:

Multiplying capsule relative location by 1000 is somewhat confusing, though.

1 Like

Hey @Csak_Te!

Everynone has definitely got you most of the way there. What I would typically do here is use a LookAt node which will get you the vector between A and B (use Get Location nodes for getting start and finish) then multiply that by a Float to get your Impulse! Also just make that Float a variable for easy adjustment. It’ll be a lot more controllable than relative position as that can get crazy variable based on the locations you have, and not often shoot in the correct direction.

Hope this helps! :slight_smile:

thanks i want to try it, which one should i use?

Apologies I don’t know why I forgot Look At returns rotations.
Similarly, but with a slight variation on a look at node, do this:

Start Vector (Object Location)
MINUS
Target Vector (Player Location)

Take that output and use “Normalize Vector” and use that in your multiply, then from there to Impulse. :slight_smile: Sorry for the mixup!

1 Like

it wasn’t bad solution, indeed its working with it :smiley:
i tried this (i know its not elegant way but working somehow…)

1 Like

im gona try this thoo

Worked!!! Thank you!
God bless u mate!

1 Like