Perception Detecting Pawn without Stimulus

Hi there,

I’m playing around with the perception system and noticed that an AI will detect a Pawn with Sight via the perception system even though the Pawn has no Perception Stimulus Source?

Steps to re-create from the First Person Template:

  1. Create an AI Controller Blueprint
  2. Add an AIPerception Component to the AI Controller
  3. Add an AI Sight Config to the AIPerception and set Detect Enemies, Detect Friendlies and Detect Neutrals to true
  4. Bind the event “OnTargetPerceptionUpdated” for the AIPerception Component and print a string when it’s called
  5. Create a dummy Pawn and add it to the level
  6. Set the dummy pawns’ AI controller class to the one you just made
  7. Run the game and walk in front of the AI and the “OnTargetPerceptionUpdated” will be called even though the First Person Character/Controller has no AIPerceptionStimuliSource component

Hey DannRees,

This is actually intended behavior. By default Pawns are registered as stimuli sources. You can disable this per sense using the config variable AISense.bAutoRegisterAllPawnsAsSources.

However, there’s no way to do this via the editor at the moment.

Have a great day

To extend the answer, you’ll have to add the following to your DefaultEngine.ini:

[/Script/AIModule.AISense_Sight]
bAutoRegisterNewPawnsAsSources=false

Cheers,

–mieszko

1 Like

Ah right I see, thanks very much!

Did this change? I tried adding it, even in different config files and it’s still detecting unregistered pawns. I also checked inside AISense_Sight and i can’t find this property, was it removed?

Cheers

Edit: i found that bAutoRegisterNewPawnsAsSources is defined in AISense, the base class of sight. But still, it dosen’t seems like the line i added in DefaultEngine.ini changed anything.

It recently was updated and you’re supposed to put it in the DefaultGame.ini now.

I tried moving it to DefaultGame.ini but my pawn is still detected. I tried recompiling but still nothing. Is there something special to do for config files to be loaded in?

This is my DefaultGame.ini, and I am version 4.16. But it’s the same with the latest. Check line #111.
https://github.com/EpicGames/UnrealEngine/blob/master/Engine/Source/Runtime/AIModule/Classes/Perception/AISense_Sight.h

Config=Game.

Ah finaly found my problem, thanks to you, it’s “bAutoRegisterAllPawnsAsSources=false” instead of “bAutoRegisterNewPawnsAsSources=false”. They changed it. I’ll add a new answer for the next souls to come around here.

1 Like

They changed the way to deactivate it from the time Mieszko posted his answer.

You should now add these lines below to you DefaultGame.ini :

[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=false