Homing Projectile accuracy

Hello,

I just tried to homing-functionality of the ProjectileMovementComponent and it’s working great so far!
However, the homing projectiles are really “bad”, they always miss the target by a bit, come from the other side, miss again and so on. It looks pretty cool, but I’d like to be able to tune how “accurate” they are … Shouldn’t it be possible to make them better at actually hitting their target? (Altering the Acceleration Magnitude doesn’t really help :frowning: )

Thanks for any ideas that you might have :slight_smile:
Regards,

I’m having this same problem. The main issue seems to be that the homing target is set to the pivot/gizmo location of the targeted component, rather than a hit location/socket/etc, so the projectile is typically ‘aiming’ for a corner of the mesh and often misses on the first pass [especially when the distance from the gun and target is small and the adjustment angle is large]. I’ve created some meshes with gizmos placed in the center and this drastically improves the hit ratio but it’s still not perfect. On top of that, you can increase the projectile homing acceleration (I think this is what it’s called?) value in the projectile BP and this will add an incremental improvement to the ‘first pass’ hit ratio at the cost of changing the projectile flight path into something less curvy. For what I’m trying to do, though, it needs to be 100% accurate on the first pass and so I’m looking into building my own homing function from scratch. I’ve avoided it, but don’t see a way around it, sadly.

Are you still working through this? Have you found a better solution?

Hey,

thanks for sharing your investigations, however I have not found a solution to this. At the moment I have those default homing projectiles, but they keep orbiting their targets for an eternity right now, which looks pretty silly when there are more than 4 projectiles at once …

It’s not THAT important for me right now though, so I’m focusing on other things and I keep hoping for someone else to struggle with this/find a solution :confused:

Your best bet will probably be to write one from scratch though I guess. I hope you find a fitting solution :slight_smile:

Have you tried making the homing acceleration magnitude significantly higher than the max speed? If I have a homing projectile with a max speed of 500 and a homing acceleration magnitude of 50,000 it seems to home in very well, instead of just orbiting around endlessly.

I ultimately ended up using a timeline to lerp up the homing magnitude over time. This way, the projectile fires straight out of the barrel and narrows in more and more over time. This seems to handle all types of shots with a realistic homing arc. Another option would be to scale up the homing magnitude based upon the distance to the target. A bit more computationally intensive, but you could force the projectile to hit the locked target, this way, at the cost of potentially losing a ‘realistic’ flight path.

1 Like

I actually didn’t try setting it that high and it makes it more realistic indeed, a medium-high value looks really good for now as I want to save ressources I decided not to compute it with lerps, but I’m glad that it worked for you (SVR33)! :slight_smile:

Thanks for your tip 0cme :slight_smile:

Have a nice day!

wow. i have been stuck with this one for a couple of days and this just solved it for me…

the issue i was having was :

  1. the homing projectile went to the feet of the enemy mesh, and that wouldnt work for me as I had enemies on roofs while I was on the floor and the projectile would impact with the walls and roof itself before hitting the enemy.

  2. I have my bullets at a certain speed upon construct and setting the homing magnitude to something ridicously high would compromise the aesthetics of the game, having bullets going way too fast…

my solution :

  1. going into my base enemy class and adding a mesh (a cube) not visible, not rendered at all and calling it homing mesh…

  2. the comment by 0cme “Have you tried making the homing acceleration magnitude significantly higher than the max speed? If I have a homing projectile with a max speed of 500 and a homing acceleration magnitude of 50,000 it seems to home in very well, instead of just orbiting around endlessly.”

What I was doing was leaving the MAX speed at 0 but that was a big mistake. Actually limiting the max speed to the same value as the initial speed of the bullet (my bullet speed is set on the construction script) and then having the homing projectile magnitude at 50,000 made the bullet hit the target everytime regardless of his height or location in the world (which is essential since I am making a top down shooter with variable terrain heights)…

Also I run a box trace at begin play in the projectile to set the homing target component to be that homing mesh I had set in my enemy base class…

everything works now… thanks guys, I have searched countless threads looking for an answer but never figured that setting a max speed would be the solution, as I tried and failed with almost every value for the homing magnitude when the max speed was set to 0(no limit)…

1 Like

Met this problem, too. But what do you mean by gizmos exactly? Gizmo Actor or just little thing in the center of the target.