- Home /
Navigation Mesh + Doors
I'm having problem with combining the navigation mesh with a door. I have a procedurally generated dungeon and some NPCs / Player controller characters (click to move).
What I want to achieve is behaviour that finds the path that is including doors but opens them on the way. Also I'm considering another behaviour that will either attack the door if closed or try to find another easier way around (adds price for crossing the closed door).
The problem is that if I just place the door there, the character will ignore them and walk through, if I make the door to be Nav Mesh Obstacle, then if it's not carve, the character approaches the obstacle in a strange way, if it's a carve one, it will split the NavMesh and thus the navigation does not find the path.
Some solutions I have found was to use raycasting, turn off the nav agent while close to the door, open them and turn on the navigation again. Other solution I have found was to attach trigger to the door. I don't like either of them, I can imagine something like raycasting + checking the speed and destination (as I don't want the character to open the door while just standing next to) could do the trick but I feel there has to be more clever solution.
I have also tried NavMeshModifierVolume and NavMeshLink but it didn't really gave me the results I have expected (or I have missused them).
Thanks
I was able to solve the "try to find another easier way around" for certain types of enemies by using Nav$$anonymous$$esh$$anonymous$$odifierVolume that modifies the volume to some super expensive area and the volume is only affecting the type of agent that cannot attack or open the door.
But I still didn't find an elegant solution for the door opening / attacking