How to tell when a wall around a target has been destroyed, allowing the AI agent to reach it?


I have a game where the enemy AI soldiers need to get through a series of circular castle walls to the target in the middle. There can be two or three layers of these rings of walls, one inside the other.

Can the AI soldiers use A* pathfinding to tell when holes have been made in the walls, allowing them to walk through the gaps in the walls and get to the target in the centre?

Also, the walls will be made of two materials - stone and wood. The AI soldiers can destroy wooden walls themselves, but not the stone ones. Is it possible for the AI soldiers to tell if only wooden walls remain between them and the target (meaning that holes have been made in the stone walls), so that they can start their attack?

Thank you for your advice.

I believe you can use the NavmeshCut component on your wall (disable the component when you want to let units pass).
However, make sure that the wall that can let units through is does not affect when the navmesh when scanning (you must change its layer to one that’s not used by the navmesh to determine the terrain).

This is not the only option, you could use tags.

Thank you - very helpful info :slight_smile:

1 Like