I just don’t understand why do I have to maintain a list of actors in sight to compensate for AI Perception weird implementation
On Target Perception Updated : only trigger once per actors so my AI is not seeing static actors when encountering them a second time…this makes NO SENS
On Perception Updated : returns a list of actors (but no age,strength, stimulus location…)
why are these two different functions ? why are they not merged ??
so far, I will have to implement my own perception using a loop with Get Actors of Class to have a correct behavior
Hi, AFAIK “OnTargetPerceptionUpdated” and “OnPerceptionUpdated” get called with the same actors, only the “OnTargetPerceptionUpdated” gets called once for each of them and also gives the stimuli info and “OnPerceptionUpdated” gets called once with all those actors in an array.
In the c++ code it loops through all new stimuli and if it calls “OnTargetPerceptionUpdated” inside that loop it also adds that actor to an array and at the end of the loop it calls “OnPerceptionUpdated” with that actor array.
Also you can get all currently perceived actors as well as all currently known actors from the perception component (for each sense or for all senses) in blueprints, so there is no need to implement your own logic to keep track of them.
And I would be careful using “GetAllActorsOfClass” due to performance reasons. If you need to rebuild the system, then better keep your own array of all actors that can trigger the AI perception somewhere and loop through those only.
Understanding and building AI perception can be difficult, especially since there is nearly no documentation about it out there other than the source code…
bumping this as super helpful.
for whatever reason “OnTargetPerceptionUpdated” gets called even if the actor is invalid (in 5.3). Running my logic through the “OnPerceptionUpdated”-Array luckily does not result in invalid actors being present.