Hi, I’m trying to make a system where the AI detects us based on the character’s lighting level. In short, it measures the level on probs and gives an average. If the AI sense the player and the illumination level is higher than 0.4, it should start detecting us.
My problem is that it only works when the character comes out from behind a wall? If I walk normally into his field of view and I’m illuminated, nothing happens. If I go out from behind a wall and I’m lit it starts detecting.
(I will add that if I remove the illumination factor then the detection works correctly based on distance)
(AI Controller) (“Succesfully Sensed” AND >0.4 propably causing a problem)
The perception system updates are only ran when the stimulus state is new for the perceiving actor. It doesn’t care about your illumination system.
A more sensible approach would be to detect changes in the illumination happening to the player and then updating the status to all actors which are perceiving it.
So for example, on successfully sensed, make the AI actors listen to “illumination level changed” event updates from the player, and then stop listening when the perception stimulus has ended.