How to make a projectile home on to a target.

I try to save posting a question as a last resort, but i am stumped. I am trying to make a projectile home on to its target (i got the target bit work, currently i am setting the target to me). Like ranged auto attacks in LoL or Dota2, or also like a homing missile. The way i am approaching it is by having the projectile find a look at target (which is me and works also) and then give the projectile movement by adding a projectile movement.

I havent seen any clear tutorials or examples, so i decided to post.

I thought that if i gave the projectile a look at target, that the projectile would move toward that direction when i give it velocity. So i give velocity in the projectile movement in the X axis. The projectile faces me, but the projectile moves in a straight line on its X axis. How can I get the projectile to move towards me (and in the end its target which i already set up, im just testing it on my character since it is the only thing in the scene right now).

Thanks in advance!

It’s probably the same or very similar to making a pawn chase a player. There’s a tutorial on that somewhere on you tube.

Try this, ignore the onseepawn part, that doesn’t work right.

NVM it doesn’t work.

Ok here’s a really rough way to do it, instead of projectile movement we need to use custom movement by manually setting the location.

We get the time, multiply by speed to get distance and then put it into a local offset in the +x direction which is the forward direction of my projectile and this moves the projectile forward over time. If the trace detects enemies, which I have set to their own trace channel called team b, then the projectile is rotated towards that enemy and the constant forward movement takes care of the rest.

This becomes iffy when there are multiple enemies present, you could make this work better by using a branch to disable the trace after it detects an enemy and store that enemy in a variable for reference. Also the rotation isn’t smooth, an interpolation could probably make it better.

EDIT: a funny thing happens if you use interpolation on the rotation, the rotation can’t keep up with the speed and the bullet starts orbiting the target.

EDIT2: See post below for setup.

Ok here’s a much better one with smooth movement that works properly (no orbiting), god **** it’s so fun to play with this.


in the 4.5 release notes it says

New: Added target homing ability to the Projectile Movement Component.

Had a quicklook, you just give it a target and away you go - looks pretty cool

I did try this and it worked, but a pawn chasing a player I believe needs a nav mesh. And navmesh is only on the ground. At least when I did i used a navmesh for the pawn to move on. It works but not how I need it to work, I need the projectile to be able to fly.

THIS work perfectly. I the thing I needed was the make actor local offset, which works perfectly. THANK you so much!

oh my gosh. cant wait!