I am trying to create an AI Perception system where the AI has multiple vision cones which give different behaviours, e.g, a short range wide angle cone to represent peripheral vision, a long range narrow cone to represent the main LOS, and a very short range circle around the character so they can detect the player behind them.
However, when I have more than one AI_Sight_Config in the Senses Config Array, only the first one (at index 0) is used. The others do not trigger any detection events.
Is this expected behaviour? Or am I doing something wrong?
If it is not possible to have more than one AI_Sight_Config in the Senses Config array, would an acceptable workaround be to create a child AI_Sight_Config class and use that?
Hi, as far as I know that is expected behavior. To get what you want, you could check whether using PointOfViewBackwardOffset and NearClippingRadius in the sight sense config are enough to do what you want (it should give you close awareness but maybe not the green periperal vision).
would an acceptable workaround be to create a child AI_Sight_Config class and use that?
I never tried that, so I do not know whether it will work.
If you use C++, then you could also consider implementing the CanBeSeenFrom function of the IAISightTargetInterface inside the actors you want to be seen by the AI. There you can then set the stimulus strength which by default is always 1.0 in the sight sense (e.g. change the stimulus strength based on dot product and distance)
Hey, so what we have done is just have 2 AI perception components and manage the inputs from them individually. It works OK but the live debugger view showing the perception stuff only shows the first one.
live debugger view showing perception stuff? graewolvneal, what is that you’re referring to?
I’m not positive that you’re going to get the result you want from above, but you can also implement your own Sight sense that adds the functionality you need, if you can’t get there from CanBeSeenFrom
Add another AIComponent to your blueprint, configure the second AIComponent with the desired sight range and angle vision. Now right click the second AIComponent > Add Event > On Target Perception Updated and that’s it. If you need visual help tell me and I will upload some screenshots.
Are they in the same AiPerception component? If so, create another AIPerception component, you can have multiple.
Then you can do separate code when either one is triggered.
Also, @chrudimer has a good idea.