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!