FPS Game AI does not seem to account for height when shooting in UE4

Hello,

I have a FPS that I have been working on for the past few months. From a functionality standpoint, most of everything is implemented.

However, I did notice one thing recently - the AI certainly rotates to look at the player, but does not seem to account for the height of where the player is at. As a result, if the player is on an elevated position, the AI will never hit them.

I am using a Behavior Tree, where I set the AI’s default focus to LastKnownPlayerLocation. As follows.

I then use SetDefaultFocus on the blackboard value from this line, as shown below.
image

Below is my code for the actual shooting itself-

Why is it not accounting for the verticality of the player? It just fires straight ahead in the player’s direction, instead of rotating upwards/downwards. As shown in the below image with the debug line(the player is on the top of the boxes).

Where is this code running? You’re talking about the “owner controller” but you also try to get the player controller – if this is run in an AI, presumably the “owner” should be the AIController?

Also, I don’t see you aiming at the player at all – the code just gets the control rotation of the owning controller, and aims in that direction.
What is setting up the owning controller’s control rotation?