AI moving only around foliage

Hello everyone, I’m creating a horror game in which the monster should go outside the wheat fields, I tried creating a context for the foliage but that doesn’t seem to work and I also tried setting volumes as obstacles, the issue I had with the latter is that even though EQS points around the obstacle won’t get selected the ai can still move through the obstacle to get to the target location.

You can see the issue on the video here

Hey Elfideo,

the monster should go outside the wheat fields

I’m assuming you mean that the monsters shouldn’t enter the wheat fields. In this case you can create a dedicated NavArea class that you’d use to mark the fields - make its DefaultCost and/or FixedAreaEnteringCost really high if you want to allow the monsters to enter as a last resort, or derive your class from NavArea_Null to mark areas where this given AI agent will never be allowed to enter.

Regarding using this with EQS just use the PathingGrid generator or PathExists test. If you use this you can even get away without creating a new area class - just use the obstacle area and in the generator/test properties pick RecastFilter_UseDefaultArea as the FilterClass - this will make points generate only on the default-area surfaces (but you’ll still have the problem of AI cutting through the obstacle area, but it depends on the distance AI needs to travel).

Let me know if it helps.

Cheers,

–mieszko

This would take a bit more coding, but depending on how you place your wheat you can add a nav generation pre-process to gather all wheat and create nav modifiers for them (you’d need to use UNavModifierComponent since you won’t be able to procedurally create volumes). Or better yet, just have your wheat implement INavRelevantInterface (or simply have UNavModifierComponent, depending on how you do it).

Hope it helps. I’ll have a look at your game in a spare moment.

Cheers,

–mieszko

Hi Mieszko thanks for the reply, oh I meant to say that it shouldn’t exit the wheat, apologise for the misunderstanding , but I guess the same concept applies of making a navmesh area class,right?

That is great and I definitely want to test it, but I was looking for a more dynamic solution, right now my problem with this method is that if we were to remove or add wheat around the map, we would have to manually find those spots, and either subtract or add the areas, it’s really error prone, do you happen to know of any other methods for something like this ?

Thanks in advance

Here’s the game I would love to hear your opinion on the AI, if you have a moment.