AI SetFocus not working correctly?

I’m trying to get my AI to move while still looking at the player after it attacks. Multiple people recommended the SetFocus node but it didn’t help. I put the Set Focus node with my AI connected (this is in Behavior Trees) then had a reference to my Player as the target. SetFocus execute to SimpleMove. It still just turns around and runs. What am I missing here?

Have you unticked UseControllerRotationYaw from the pawn and ticked UseControllerDesiredRotation in CharacterMovementComponent?

15 Likes

I Just want to to know, that this your answer helped me - 1 & 1/2 after you posted it- too. Thanks!

2 Likes

Same here.

ClearFocus wasn’t working for me and this fixed it. Thank you.

1 Like

So what if both of those boxes are already tick/unticked as you say but the AI still isn’t turning?

also make sure “Orient Rotation to Movement” is unchecked

1 Like

If you’re still having issues consider that the AI Controller might be the problem. In my case I made a Custom AiController (C++), but I disabled bCanEverTick which is needed for setfocus to function properly, as soon as I unchecked it, it worked! In BP I think it’s called ‘Start with Tick Enabled’ within your AiController.

1 Like