I have some cover based logic up and running, the problem occurs when you invalidate the AI’s position - they will often run towards you to get around their current cover. I want them to run away.
Is it possible to do something like increasing the cost of travelling over the navmesh near the player? Or is there a better solution?
You can turn on the character affecting navigation. This does mean the navmesh will have to be rebuilt at run time, but it might be performant enough for you. Once the character affects navigation, you can change the area it affects and the cost of traveling through that area. Then the AI should path around the player at whatever radius you give it.
ok good to know, but how do I actually implement this? thanks.
You need to set
true on both player’s pawn and it’s collision component. Regarding the navigation area class use by it I’m afraid it cannot be set via BP (but in C++ everything is possible! :D).
I’ve tried this to have my AI “cut holes” in the nav mesh but it seems that when they move from one cell to another they leave an artifact hole on the navmesh since no pawn is there to cause an update.
You can have your Pawn affect the Navigation in Blueprint by using Set Can Affect Navigation Node. Then turn on Rebuild on Runtime on the RecastNavMesh.
Though I’ve noticed odd side affects. Anyone else care to input? If you use Move Directly Towards in the Behavior Tree it doesn’t stop on overlap ( I thought that was the problem ) – which resulted in jitters in movement when the NavMesh updated.