In my game, there will be bombs randomly flying down from the sky and they will project a danger circle onto the ground indicating they are about to fall down on that spot in 5 seconds. I’m trying to implement my AI to immediately run out of a danger circle if it spawns on top of them or to avoid them if the danger circles spawn in their path.
I’ve managed to implement this by making my danger circles spawn a nav mesh modifier that sets the nav mesh within the collision circle to be an “Obstacle”. This is pretty awesome because wherever my AI is running, it will avoid those danger circles.
The problem with nav mesh modifiers is that it only works while the AI is moving during a “Move To” task. I want my AI to realize that it is currently standing in a danger circle, or a danger circle has spawned on top of them, and they need to immediately get out of this spot and find a safe place to stand.
I was wondering if anyone knows a solution to this problem that comes with a feature in the engine that I don’t know about (like maybe some way to use AI perception or something) to implement this solution. I was about to try something where when a danger circle spawns I will calculate the vector from the AI character to the center of the circle and make the character do a “Move To” away from the center of the circle until it detects that it is no longer in its collision radius. This feels a bit problematic to me because I would have to consider what happens if two danger circles are overlapping etc.
If anyone has a good solution to this, please let me know! Thank you!