- Home /
I want to use NavMesh AI AND I want to place and destroy blocks.
I've baked a navmesh with an AI Enemy. I want to be able to place blocks and have the enemy navigate it's way around them. I also want to be able to destroy these blocks. Apparently you can't generate a navmesh at runtime. How can I do this?
Answer by incorrect · Jan 23, 2016 at 12:56 PM
Take a look at Navigation and Pathfinding, especially at Creating a NavMesh Obstacle page. It's exactly what you want.
NavMesh can not be backed at runtime, but can be 'cut' by obstacles.
Thank you for your reply, however I did look into the Nav$$anonymous$$esh Obstacle page and found that you can choose to carve or not carve. Not carving means that the AI will try to continue on it's usual path, but will get stuck at the obstacle. Carving it will make the AI try to navigate around it -- but when you remove the obstacle, the carved space still remains as if the obstacle was still there. I need the navmesh to be restored to what it was once the object is removed.
Any ways around this?
Answer by bloeys · Jan 24, 2016 at 03:07 PM
How about you move the carved object away from the navmesh, that way the navmesh will update without the carve in it, then once it has been updated you can safely remove the obstacle.
Your answer
![](https://koobas.hobune.stream/wayback/20220612061315im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
I want to use NavMesh AI AND I want to place and destroy blocks. 0 Answers
Navmesh Agent moves odd when bumped 1 Answer
how to get AI to move to the closest of the same object? 0 Answers
Navmesh agents pushing character controller, how to stop this? 1 Answer
"SetDestination" can only be called on an active agent that has been placed on a NavMesh. 0 Answers