It casts a sphere trace and the actor that it hits becomes the target for the “SetRelativeRotation”. It does work and the actor does look at the enemy and moves towards it but my problem is that if it gets close enough, like a half a default cube size, it just stops. As in, if the enemy dodges to the right, it would just stop rotating the actor and go in a straight line
This is actually fine for me but im hoping for a upgrade that makes the tracking more accurate so i was hoping for a way to fix it. The only thing i came up with was top spawn another one if it gets close enough, and doing so would cause the newly spawned one to directly look at the enemy. But im hoping for something thats more smooth, Atleast from the players perspective
If you’re using projectile movement component, it has built-in homing functionality.
Tricky part is dialing in the homing acceleration magnitude so it turns fast enough to hit moving targets without being so fast it seems to do abrupt 90 degree turns in the air.
Thanks but i forgot to mention that im on 4.27 and there isnt a homing target component. Even then, im more interested in trying to actually fix my own method just in case something similar happens in the future and i need to fix. Though i did find out that if i just place the projectile in the scene without it moving at all, it would be able to perfectly track the target, no matter how close the target moves towards the projectile.
This issue mainly occurs because the spherical detection has lost the target. You must continue the tracking for a certain period of time even after the target is lost. The simplest solution is to add a timer. Keep tracking the last lost target for a certain period of time. Only after the time limit is exceeded should the target be lost.