What are the best ways to setup differents NavMeshBoundsVolumes or ModifiersVolumes for different lAs ?

Hello, as the title says, what is the most efficient way to assign zones (for example to patrol) to specifics actors/ characters (IA) I have?

For a more clear example, lets imagine I have a ROOM with one door and a corridor next to it. (Use the two images provided for a better understanding)


Important: when i says AICh…1, AICh…2, and so on I am using the same CharacterBP reference and using it at the same time multiples times. They are not seperate BP or class

  • I want IACharacter1 to only use the ROOM to perform actions (such as move) (Red Zone)

  • I want IACharacter2 to only use the CORRIDOR to perform actions (such as move) (Yellow Zone)

  • I want lACharacter3 to use the ROOM and CORRIDOR to perform actions (such as move) (Red and Yellow Zone)

  • I want lACharacter4 to use another navvolume which is in a part of the ROOM and CORRIDOR to perform actions (such as move) (2nd image, blue Zone)

Again, what is the BEST / most OPTIMISED way to do this? (Q1)

Should I use multiples NaMeshBoundsVolumes? One NavMeshBoundsVolume and split it ? (Q2)

Can I use a variable for each character I place and give it a nav object reference in the world ? (Q3)

Can I give him arrays ? (like connect Zone Red and Zone Yellow then disconnect them later) (Q4)

Thanks to anyone who will answer these questions

Q1 → I’m pretty sure placing multiple navMeshes would just combine into a single mesh in practical uses anyways, so I would suggest using a single navmesh in the entire map if possible.
You can just decide in code where to patrol. I think there’s a good way to make this easy to setup using gizmos, but you basically give them two corners (top front left & bottom back right). If you’re hand-placing the enemies, their patrol routes should probably be manual anyways.

Q2 → You can’t split NavMeshBoundsVolumes explicitly, but you can decide where to patrol in code.

Q3 & Q4 → You could. It wouldn’t be good to use multiple though.

Thank you for the answers :slight_smile:

Patrol was a example, but for example if the AI is chasing the player or moving to something, how can it knows “where” to stop because of the limit ? (Q1)

If I continue with my “ROOM” and “CORRIDOR” example, if the AI in the ROOM starts to move towards the player (who is in the CORRIDOR), how does it knows the “limits” ? (Q2)

In this example with my “ROOM” and “CORRIDOR” i only have one entrance so I could detect if the AI enter the exit with a overlapping event with a trigger box, but if I am in a open space ? (Q3)

Here I have 2 AI (from the same BP, I added a outlines for me so I can debug)


How can I detect when the IA get out “of the box” ? (Q4)

For Q4 i thought about using a trigger box for each “zone”, and if the AI stops overlapping Event End Overlap it gets back in, but I dont think its a great idea because I will have dozens of those AI at the same time, can you think of a more optimized alternative? (Q5)

Q1 → That comes down to game design. Do you really want your AI to forget the player ever existed once they step through a doorway?

Q2 → If you’re talking about wondering how it will physically reach them, the walls would distort the navmesh; they won’t try to go through collision. Though, you can uncheck “can ever affect navmesh” if you’re looking to create a bug you’ll spend forever trying to track down.



Q3 & Q4 & Q5 →

You’ll be fine using trigger boxes. I don’t think there’s a less computationally demanding way- box collision is pretty ■■■■ efficient nowadays. Having 100 box triggers is fine- having 100 navmeshes would probably be performance suicide.

I now know dam with an n at the end is censored on this forum.

I would probably recommend doing something like this:

  1. Create an actor- I’ll name it RoomBounds
    image
  2. Inside, add a Box collision component.
    image
  3. Create a instance editable (eye icon) array of the created actor class inside said actor class
    image
  4. Place them in your rooms and connect them up by setting references to the connected rooms like so

Though this specific solution will only work for cuboid shaped rooms (or rooms that can fit inside a cube without overlapping other rooms).

The nav mesh will handle the navigation.



To check which room you’re in from the player/AI character, simply get overlapping actors with a filter of room bounds

thank you for the informations and example !
I like the idea of connecting rooms with a array

edit:
It works perfectly ! Thank you again :slight_smile:

1 Like