Any way to make a homing projectile go straight to target?

So, i’m making a RPG like setup where the player has the ability to cast single target spells.
To implement this, i’m using the homing target component from the projectile movement.

My problem is, sometimes the projectile don’t go directly to the target, it keeps spinning at the target a random number of times before hitting it.
It causes lags (when the acceleration magnitude is set to a higher number it causes way more) and sometimes it causes the target to fly off the map lol.

The way i discovered this is by setting the acceleration magnitude to a lower value than the skill missile speed, so i could see the path it was taking.

What i want to do is get a way to make it to go straight to the target, it doesn’t matter if the mesh isn’t rotated correctly or anything, i just want it to hit at the first time it gets closer to the target.

I had a similar problem a while back and made a video for it then. While I’ve changed the BP a lot(fixed a few redundancies, optimized it and added in integration for other parts of my engine), since then, the biggest key thing you’re looking for is the “create vector from yaw and pitch” node; so the video is still plenty relevant. This should get you on the right track:

1 Like

Depending on the collision volume, overlap should work just fine. If you want to be extra paranoid, you could use a radius check as well. It’s an on tick projectile, so the “lag” is dependent on frame rate and how “laggy” the target is. Regardless, using this setup, the projectile can’t miss. Even if the target teleported, a split second before impact, it would immediately angle snap to the new location; while still having the same velocity.

The large level issue is more of a digit precision issue. When a projectile needs to turn 1.32324564646747463 degrees, to home in on a target, you can get a float rounding error that rounds it to 1.32324565 or something; which is incorrect. Therefore, it will have to correct itself again and that might lead into minor snaps and pops.

You guys are ****ing amazing. I solved the issue by checking (using an event tick) if the projectile is close to the target.

I don’t really like using event ticks, the idea of things getting checked everyframe annoys me. So guess i’ll use a timer and be done with it.

Thank you!

No problem, and on tick is fine, so long as you don’t have hundreds of projectiles ticking at any instantaneous moment in time. But yes, it’s definitely good to try to avoid on tick actions. A timer on a 0.07ms(14 tick/s) or 0.05ms(20 tick/s) interval would work fine. The only reason why I’d suggest using the real tick here, or something close to it, is because projectiles can be fickle and hit reg can get annoying.