AI Sight Perception triggered and immediately lost

I’m following Tesla Dev’s behavior tree tutorial found here: Unreal Engine 4 Tutorial - AI Behaviour Tree - YouTube

When I add the AIPerception component to my AI controller, I’m getting some strange results.

It appears as if the AI is successfully seeing the target and then immediately losing sight of the target. The screenshots show that when I hook up a print node to the “Successfully Sensed” pin, it reports true, immediately followed by false, immediately followed by true, etc. I don’t think it’s value of the parameters in the AI Perception Senses Config, but I’ve posted a screenshot of those as well.

In the tutorial, the ‘Successfully Sensed’ boolean sets a variable that drives a condition in the AI behavior tree, so when it is constantly triggered, the behavior tree does not drive the expected behavior.

Am I misunderstanding how the OnTargetPerceptionUpdated node works? I would expect that this event is only triggered when the ‘Successfully Sensed’ boolean is updated only when the AI perceives the player or when the conditions of “losing sight” (as defined by the senses config parameters) are met.

pls see this page.
To see if you lost perception of an actor you need something like this

I ran into the same problem. I debugged the C++ code and found the cause of this problem.
In my case, I set a bigger Sight Radius value compared to the Lose Sight Radius value.
If you have any interests, please refer to CheckIsTargetInSightPie() method in AISense_Sight.cpp.
Hope this can help you.

I ran into the same problem. I debugged the C++ code and found the cause of this problem.
In my case, I set a bigger Sight Radius value compared to the Lose Sight Radius value.
If you have any interests, please refer to CheckIsTargetInSightPie() method in AISense_Sight.cpp.
Hope this can help you.

I have the exact same problem. Successfully sensed is getting set to true and false alternatively and continuously. I have no idea what’s wrong! The lose sight radius is greater than sight radius too!

1 Like

Did you ever solve this? I’m having the same issue. If I stand still, the AI loses track of me immediately. My Melee AI run up, do 1 attack, then pause, and leave. Sight won’t keep track of the player unless the player is moving.

1 Like

I had a very similar issue: Successfully Sensed boolean on BreakAIStimulus was alternating true then false continuously. In my case it was because the actor I was using as a stimulus had a pivot which was located exactly at the height of the floor. When I moved the actor up slightly the Successfully Sensed boolean remained True while the stimulus was in sight and immediately became false when the actor was out of sight.

I have successfully fixed this exact same issue, it was because I had more than one pawn that was being seen by the bot.
The solution was to make a cast to my pawn directly from OnPerceptionUpdated(AiPerception)->ForeachLoop->Cast to my player pawn.

I have the same problem, AI sight and lost sight when the character is moving.
I found my problem is the weapon of the character might block the sight, set the weapon to ignore all collisions does solve the problem.

1 Like