/Unity-NavMesh-adding-Obstacles-To-Terrain-Trees

This small addon for the unity NavMeshComponents that allows you to load your Terrain trees as actual obstacles into the navMeshSurface.

Primary LanguageC#

Unity-NavMesh-load navMeshObstacles for your terrain trees

This is small addon for the unity NavMeshComponents that allows you to load your Terrain trees as actual obstacles into the navMeshSurface.

For the Script to work you have to add Either a CapsuleCollider or a BoxCollider to your tree and ajust it on how big you wana have the NavMeshObstacle Componnent. If you don't do this, The NavMeshObstacle does not know where to get its value from and the script stops working.

Tut1

Check if all the trees you want to have a NavMeshObstacle for are in your Terrain Tree index. Tut2

Before hitting the play button, Check if navMEshSurface has Baked the Terrain. then add the Scrip and hit play. (it loads relativly fast on 30k trees). After Loading you should see a gameObject named "Tree_Obstacles". in there are all the NavMeshObstacle. Done.

tut3

Link to Script : https://github.com/Malikir324/Unity-NavMesh-adding-Obstacles-To-Terrain-Trees/blob/main/SetTerrainObstacles.cs