AI pathfinding shall consider destructible actors

Hi,

my AIController is currently mainly based on the Behavior Tree Quick Start guide but I want my AI Pawns to consider to move through closed doors. They can’t open a door but they can destroy it as long as they stand in front of it.

I would be fine if the pathfinding algorithm would simply ignore the door as long as the collision with it exists. Though it would be nice to increase the cost of the door so the AI won’t ever try to get into a room by destroying a closed door when there is an open door directly next to it.

Can someone help me? The only help I find in related topics are for the opposite way, preventing AI from moving through accessible areas.

Still nobody has a hint? I am pretty sure that’s a rather common problem. I discovered NavLinkProxys and it works as long as I place them in the level editor on each door. But the player in my game is able to build doors everywhere on the map and so that way it’s not going to work.

I tried to add a NavLinkProxy as child actor class to the door class but I didn’t get that to work. The NavModifier component looks to me like it could’ve been made to solve such problems but I wasn’t able to make that work either.

One way I can think of getting this to work is to have your pawns draw a line trace by channel forward a set amount and have it stop movement of the pawn when the hit object is equal to the door. Obviously when the pawn is there it can slowly damage the door. Then when the hit object is removed set the movement back to default. You might need to draw a few at different angles so if the pawn comes in at an angle it wont get too close.

to get the pawn to try to get through you will then need to create a box collision in your door blueprint that encompasses the door and under its details enable ‘dynamic obstacle’ and under ‘area class’ set it to ‘NavArea_Obstacle’, which has a high cost (or create your own so you can adjust it to suit).

Next you will need to make sure your recast nav mesh is set to dynamic and ‘force rebuild on load’ is enabled.

Back to your door you have to put a destroy component on the box so it gets destroyed when the door is broken (or destroy the entire actor). The pawn will need to have its movement re-enabled so it can move again.

So the above should have the pawn try to take the shortest path to its destination and stop at the door. If another door is broken then it will take that route.

Hope this helps.