How to make AI avoid a large moving area in real time?

I have an enemy AI which has to follow the player. There are also some moving characters. The enemies cannot be near the characters, as they have a damage area (poison).

The enemies should try to avoid the characters at the time they are following a move to command. As only some enemies are affected by the poison, I have created a nav modifier, which I use as a filter on different AIs.

The problem is that even if the nav mesh rebuilds dynamically, it does not rebuild quick enough to rebuild it every tick (move the poison collision area with the enemy).

What can I do so that the AI avoid the characters?

Thanks

Hello!

You may use a volume big enough to avoid these poisonous characters , when they trigger you have the information about position you need to avoid them.
It’s very simple but working… You can also put the volume in front of to mimic a visual , still in a simple way but also lighter.

Rebuilding nav mesh every tick is not really good :frowning: too heavy! It’s an operation to do not often, maybe every second or more for me, or fired from a particular event… In short when really needed.

Hope it helps!

Ok right! I knew it was too simple…

But I still think my method is not really bad… It needs some improvements…

So, instead of a volume, you can trace (cone or sphere) to the direction you are going (just like every half second) or still use a volume in front of you… And if there is something poisonous then rebuild nav…

So you rebuild it only if needed and with some useful informations…

The good thing is that your AI can also fail if it watches in the wrong way, adding extra truly behaviour

The problem with that approach is that the AI is already heading to somewhere. I do not want to acquire a different target, nor escape from the poisonous characters. If the AI is going somewhere, I want them to continue going there, but avoiding the poison area.