Enemies keep looking towards Player character after detecting once

I’ve been following the Unreal 4.1X course (old, i know, but i started it a while ago and just got some time to finish it up). After refactoring the AI Behaviour trees and making the Mannequin C++ class, I noticed that the enemies don’t walk like they should anymore. The do walk towards their next patrol point, but they keep their rotation towards the player character. I’ve been trying to debug this issue for quite some time now, but I just can’t seem to figure it out.

That would suggest you aren’t clearing the focus when losing line of sight.

Hi, Thanks for the response. That’s where I’ve been stuck, I don’t think the focus isn’t overwritten, because the AI starts walking towards the next waypoint, and the blackboard keys Enemy and LastSeenLocation are emptied

None of that is what determines what the AI is focused on. Where are you clearing the focus in code?

Thanks, this made it clear to me that I wasn’t looking at the right spot. I’ve been able to fix it by making it so that the enemy’s focus is cleared during the "UpdateLastLocation step. I probably missed this/deleted this during the refactor. For anyone wondering, I changed the following


To

and it seems to work.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms