AI Controller rotation

So, I am currently making a 1v1 PvE basic concept prototype of a project I want to make. The end goal is like a PvP FPS like Hell Let Loose. But for the sake of prototyping and with my limited knowledge, I am using an AI to take place as my opponent. Anyways, I am trying to get the controller of the AI to get it’s rotation set to face the position of the player. I would be doing this in a service node for the behavior tree, but for testing purposes, I have it running on the tick. But conceptually I do this:

  • Verify the npc has the player actor key in the blackboard set
  • Use the Find Look at Rotation node with the start input being the npc’s location and the target being the player’s
  • Use RInterp To node with the current rotation being the controller’s rotation and the target being what was calculated by the Find Look at Rotation node
  • I then use set Control Rotation to update the the controller’s rotation.

I have debug print strings that show that the math works and theoretically things should work, but the major problem I run into is that the pitch is frozen in place. Below is just a demonstration of my logs each tick.

Tick 1
Controller rotation before
P=0.000000 Y=129.702750 R=-0.000000
Look At rotation
P=0.352012 Y=110.503717 R=-0.000000
Interp Rotation
P=0.027279 Y=128.214911 R=-0.000000
Controller Rotation After
P=0.027279 Y=128.214911 R=-0.000000

Tick 2
Controller rotation before
P=0.000000 Y=128.214911 R=-0.000000
Look At rotation
P=0.355142 Y=109.060833 R=-0.000000
Interp Rotation
P=0.027183 Y=126.748810 R=-0.000000
Controller Rotation After
P=0.027183 Y=126.748810 R=-0.000000

The character is set to follow the rotation of the controller so that the controller drives where the NPC is looking. The reason I need the pitch is I pass the pitch to the animation blueprint to deal with the aiming offsets. I’ve looked into using SetFocus and SetFocalPoint, but the problem with these is they will snap to their focus instead of interpolating like I manually did and the focal point also disregards pitch. So it makes it hard to have the npc exhibit human behavior by shooting at the player’s last known location if the location is not straight in front of them.

I know for a prototype that these issues are not a problem, but I still would like help figuring out what is up. Clearing the focus doesn’t do anything, it’s never even set in the first place, I’ve had this logic go from a service node, to a task node, to a method in the controller, and to a method in the ai character blueprint. I have nothing that alters the rotation of the NPC outside of this so I have no idea what keeps undoing the pitch I set.

The only workaround I can think is to just have a float variable store the pitch that would be passed and have it be passed to places like the anim blueprint. Would require me to basically go into any part that gets the rotation and split it’s pins to use the yaw and roll while passing the individual float variable I make. And no matter the path I go, I also noticed the pawn sensing also doesn’t exactly adjust it’s rotation with the controller, but with the actor itself, but that is a different issues that I am not too worried about.

Anyways, sorry for the long post, but was trying to be thorough in my explanation. I can provide pictures if anyone needs any.