AIPerception detecting WITHOUT AIStimuliSourceComponent defined

Hi everyone,

I’ve been working on a school project where we’d like to make AIs detect players with sight. So we decided to work with the UAIPerceptionComponent to do so.

We’ve followed a couple of tutorials and tested a lot of things on our own since there’s not so much documentation on the subject. We can make it work, but the problem is that our AIs detect ANYTHING that’s moving even when these moving actors ARE NOT registered as stimuli sources - meaning that AIs detect each other which is something that we don’t want. We only need our AIs to detect the players.

All we’re doing is setting a UAIPerceptionComponent and a UAISenseConfig_Sight in the constructor of our custom AI controller derived from AAIController as shown in the screenshot below.

And that’s it. Nothing more. We never register our player or AI characters as stimuli sources by creating a UAIStimuliSourceComponent or even using UAIPerceptionSystem. Despite of that, our AI still works and detects moving actors getting in the sight range. And my question is why? We even tried to force the engine not to register all pawns by writing those lines in the DefaultEngine.ini but nothing changed :

[/Script/AIModule.AISense_Sight]
 bAutoRegisterAllPawnsAsSources=false 

The thing is that we then have to cast the sensed actor received by TargetPerceptionUpdate in order to do stuff like store the player in a blackboard. But the most annoying part is that we’d like to unregister a hurt player so the AI won’t chase him when they’re on the ground waiting for another player to heal them.

Does anybody have an idea of what we did wrong? I can’t seem to find any similar question on forums…

Thanks in advance!

Hello CedSentenac,

I am in the exact same situation. I wanted to cry when I saw that no one answered your question. Did you find an answer to this? I want my AIPerceptionComponent to detect only sight and damage. My player pawn is not registered as a source to sight and damage and my AI Perception still detects it. Clearly my player pawn is registered as source for some reason, but why?

Look what I found.

It’s been a while now and I’m not working on this anymore. But to answer your question, sadly no we never found a way to resolve our problem with the registering system. We actually filtered manually the unwanted source of stimuli… A poor way to do it but it was a school project so performance didn’t really matter.

If I remember well, we actually tried to set our player not auto register, but I’m not sure if we did it with the .ini modification. You could give this a try :slight_smile:

Did anyone found a solution to get Pawns not autoregister?

Edit: Seems here is a solution:

Here you find a solution to not making pawns autoregister as stimulus source:

 [/Script/AIModule.AISense_Sight]
 bAutoRegisterAllPawnsAsSources=false

Credits to “part time commie” in linked thread.