My game is a top/down 2D game. I have a Actor (NavmeshAgent) that moves inside a house with about 5 rooms with doors that can be closed or open at different times.
What I would like is that when I ask the Actor to go into a room with a locked door, that he will aknowledge he cannot get there and not even move.
Right now what happens is when i ask the Actor to go into the room he will walk towards the door and since the door has collision he will just stay walking into the door until I send him somewhere else.
I tried to put each door on a different NavMeshLayer and change the status of the NavMeshAgent.walkableMask but since I have several doors that can be open or closed at different times I cant figure out how to change the walkableMask for each possible combination.
Also is this the best way to achieve that or is there another technique?
I’m just using 5 doors but ideally I would have a lot more in the environment, more doors than NavMeshLayers…
I was wondering if there is a way to calculate the path to the room and if that path goes through the door collider than it would become invalid?