Hi, I’m currently looking into the UE4 AI systems and have run into a problem with the AI Perception. I can’t figure out how to access the individual senses updates in Blueprint. If I have both Sight and Hearing how do I access the hearing sense specifically?
So to simplify: If, for example, I want my AI to jump when he sees me and die when he hears me. How would I go about that?
This example prints in the screen the number of the stimuli for the sensed actor and the type it belongs to. For this to work you should use the Noise tag on every noise you make. It would be nice to have a better way to do this, but right now i don’t think there is in Blueprints (if there is please let me know!). Hope this helps.
You don’t need to use Tags:
The array index from Last Sensed Stimuli corresponds to the order of the Senses under the AIPerception>Senses Config .
In my case I have
0 = Sight
1 = Hearing
.
Every time you loop through the last sensed stimuli array you will get each of your senses in order and all the info associated with the last time that sense perceived something. You can then use the Age to find out which sense was updated last if you like. In my case I tag the sounds to describe what they are , footstep, explosion etc. etc. and I only need to do that for element 1 ( hearing ), not element 0