Hello all! I am using the new AI Navigation package in my project. When I bake the nav mesh from my terrains NavMeshSurface component, it doesn’t appear to be taking my terrains trees into account. As you can see, there is no radius around the trees to prevent a navmeshagent from walking into them. I have tree colliders enabled on my terrain collider component. If anyone has any tips, I would greatly appreciate them. Thank you!
Add a NavMeshModifier to the tree.
If the tree trunk is too short, sometimes the branches will get caught up in the system (very rare), in that instance, create an empty GameObject on the tree and add a Capsule Collider to cover the trunk. Then you’ll want the NavMeshModifier on that instead.
You’ll have to rebake, of course.
Hi Brian, thanks for the reply. Does this work for trees that you place using the Terrain Paint Trees tool? I am unable to individually select my trees from the hierarchy. I tried adding that component to the tree prefab, but it doesn’t seem to have an effect after rebaking the nav mesh.
Apologies, I missed the Terrain Trees part. Unfortunately, the NavMeshSurface has an open issue (like for SEVEN YEARS) with the Terrain trees and not picking them up. It’s something they “plan to fix”.
For a follow up on this. I’ve actually used the NavMeshSurface since almost the beginning (since 2018). What I generally do is use terrain trees in areas inaccessible by characters (enforced with invisible GameObjects with colliders and NavMeshModifiers in those areas characters shouldn’t go), and manually place trees in areas where characters DO go.
It’s not perfect, but Unity has put updating this issue so far down in their priorities that it’s not even on the back burner anymore. Honestly, when 2022.2 came out and we’re pretty much pushed into the Surfaces, I figured they’d fixed it.
In any event, despite the workaround, working with the NavMeshSurface has many other advantages over the legacy NavMesh, including finally being able to use those agent types (you can have a surface for Humans with one set of settings, and a surface for giants using settings that might not let the giants go through.
Thanks for looking into it! I think I will go with your method and redo the trees. My scene is relatively small so it shouldn’t be an issue. I still plan on using the new Nav mesh system in the future. I can think of a few different ways using multiple agent types could lead to interest gameplay scenarios. Thanks again!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.