I understand that in Unity 3.5, the NavMesh system was updated to bake the mesh around trees. However, it seems as though there is no option to ignore them!
For the purposes of my current project, I actually want to ignore trees for the purposes of hard navigation via NavMeshAgent.
I have tried the following:
Uncheck ‘Create Tree Colliders’ on Terrain Collider component and re-bake navemesh
Uncheck ‘Draw Trees’ on Terrain Component Settings tab and re-bake navmesh
Ultimately I realise that I could bake the navmesh before applying the trees, but unfortunately that is a time-consuming process since our artist has already created our terrain.
Another option is to use custom navigation - something we’ve considered but obviously a simpler solution would be superior!
This is a glaring oversight and a big pain in my butt. Why does the navmesh generator completely ignore the “create tree collider” option? Now my AI carefully avoids stepping on any tiny plants or grass even though none of them have a collider attached. It’s ridiculous.
Is this problem submitted in the bugs forum? Having to erase all foliage, then generating navmesh, then ctrl-z ing everything back is cumbersome. And what if you need to have walkable shrubs but you need trees to block paths? It can’t be done unless you add shrubs at the very last step of level creation. This is a SERIOUSLY ANNOYING limitation.
pipiroo6’s workaround has inspired me, and i have one that some might prefer: make a prefab of an empty game object, and when you need to bake, hit “edit tree” and choose this prefab for all trees you want to ignore. Still not perfect, but less cumbersome for me at least.,pipiroo6’s workaround has inspired me, and i have what might be a better one for some people: make a prefab of an empty game object, and when you need to bake, hit Edit Tree and replace the tree(s) in question with this prefab. then you can put the originals back when you’re done baking. still not perfect, but slightly less cumbersome in my opinion.
I just found a similar answer, and it is based off of the ctrl + Z method. I had already finished my terrain, with large amounts of grass a trees, so naturally didn’t want to erase everything. After reading the ctrl + Z idea, I realized that you could delete the trees (or grass) from the terrain brush tool, Re-Bake the navmesh, then press crtl + Z to replace the vegetation. It should not remove any of the vegetation after you press ctrl + Z, but i do advise saving the scene first in case something doesn’t go right.
I found this to be an faster solution.
in case if you used terrain trees for designing terrain and afterwards if u need to bake the navmesh,
set scale of the original prefab asset to zero at all axis which you used to plant trees or grass,then rebake.
,
in case if you used terrain trees for designing terrain and afterwards if u need to bake the navmesh,
set scale of the original prefab asset to zero at all axis which you used to plant trees or grass,then rebake.
Yeah so you can basically erase all your trees, hit ‘Bake’ and then just do the Ctrl+Z a few times. Ctrl+Z undoes the trees deletion, but does not affect the navmesh that you baked.