Enemy NPC sometimes has trouble shooting me when it is firing from a high or low position.

So my npc pawn refuses to aim at me when it is firing from a high position when I move too close to it. However it will still shoot at me if I am far away enough. Been looking for answers or hints, but frankly, I’m stumped. Furthermore, not only does the npc not track me from a high position, the nature of the projectiles for some reason, looses its impulse and just floats. No clue on that part either. (more percisely, the whole npc faces me in a horizontal axis only, but I’ve assigned a bone that tracks me in all axis.)
Click here for a video of what I’m talking about.Enemy NPC sometimes has trouble shooting me when it is firing from a high or low position. - YouTube

this is how it is setup in the character blueprint. In here, the projectile spawns from the Bone(named HeadTop_End) i’ve assigned to the GetSocketLocation:

In here, I set a bone(named HeadTop_End) from the skeleton to track me, with the look rotation variable.

Here is the function that is associated with the look rotation variable. You’ll notice that I had to add +3 degrees on the y pitch of the break/make rotator, because without it, the NPC aims too low; at the leg area of the player. It’s a crude workaround, so if anyone has any ideas of how to make the enemy naturally aim at a higher postion of the player pawn, that would be great.

I’m also very open to a much simpler method of having the npc aim at me, if there is one. But from what I could tell, the problem I’m having is probably maybe in part due to the bone(named HeadTop_End) not tracking me anymore when the NPC is too high up and I move too close to it.

Well, for the third pic, I just realized I could simply put a + vector after GetActorLocation and raise the z value to get npcs to naturally aim for my head. But Still I have trouble with the NPCs not aiming properly at me if I am close to them and they are high up.

Are you sure the geography isn’t blocking the detection?

yeah, that seems to be it, kinda. Just now, I set it up so that the projectile doesn’t collide with one of the NPC components that it was spawning inside of, at certain angles. Apparently it was bouncing off of itself on spawn whenever the bone looks downward

Here is the function needed to calculate a launch trajectory:

It assumes that you already know the shooter’s position, target’s position, projectile gravity, and projectile velocity. It returns two positions the NPC can aim at in order to hit the target; a high arc and a low arc. It will also return a boolean to indicate if the target can be hit at all.

This is how you might set it up in your NPC blueprint:

If you don’t want to have to copy everything from the image, you can try copying the code here and pasting it directly into a new function. You will still have to set up the Input and Output pins.