BehaviorTree rotate AI to face actor (player)

I’m struggling to get the AI to rotate towards another actor (the player) when not within the attack cone radius. So far I have it working fine to respect my attack range where the AI will move within range. It then respects the attack radius via cone check. The final real issue is the AI refuses to rotate to face the player.

I know the “Rotate to face BB entry” requires the pawn to have controller yaw, but despite turning that on it still does nothing. The AI just sits there. I am however using navmesh walking and wonder if that’s why it might not be working.

Is there another way or better way to rotate the AI smoothly to face the player instead of this node? Custom BT Task maybe? I’ve also tried SetFocus, but it’s not ideal as it makes movement janky due to having to turn off movement based orientation.

I’m not able to use timelines in BT Tasks so looks like the only option is to call a BP function to do the rotation and report back success. Maybe it’s better to just put this in my Attack function so the AI rotates then attacks in 1 step.

Managed to get it to work from BT using a ticking task.
BT

Task

Also cleaned up some of the nodes as it wasn’t necessary to nest tasks in an empty sequence.

2 Likes

Great job. This is how I do rotation.