- Home /
Unity 3.5 Pathfinding with terrain and trees.
I've recently been testing the pathfinding in Unity 3.5 beta. In our project, we use a terrain which has a number of trees on it. We have created the tree colliders properly. (They work when using a Character Controller.)
When I bake the Navigation on the terrain, it doesn't appear do anything about the trees on the terrain. Our characters which use the pathfinding walks along the terrain properly, but just walk through the trees when using the movement from Nav Mesh Agent. What can I do to get the trees to be part of the pathfinding / Navigation Mesh?
Answer by gekidoslair · Sep 14, 2014 at 10:08 PM
This is not fixed in 4.x still - I have a terrain with trees on it and navmesh generation is still breaking my navmesh generation.
this is ridiculous.
I've just tried with a simple tree on a terrain in 4.5- it seems to work just fine. Please submit a bugreport with the problematic scene/project.
Cheers.. /Jakob
Answer by asafsitner · Jan 09, 2012 at 09:14 PM
Try putting primitive colliders on the trees. Navmesh agents work differently than character controllers or rigidbodies. Do you get the same problem with imported mesh collider? And convex?
Also, try placing your trees so that they penetrate the terrain slightly. If you place a collider above the 'ground' the navmesh computing won't recognize it and treat the area beneath it as walkable.
Our trees do have capsule colliders on the prefab.
When I try inserting one of the tree prefabs into our level without using the terrain system then bake the navigation, the navigation mesh is generated correctly and the Nav$$anonymous$$eshAgents work correctly for that tree.
I've also gone through all of the tree prefabs and set the Navigation Static flag to true, but that didn't help either.
I was able to reproduce the problem, but couldn't find a solution yet. I presume it's a problem with the navmesh baking system itself. Let's hope they fix it when it's out of beta.
Answer by Jakob_Unity · Jan 19, 2012 at 11:35 AM
,An issue where terrain based trees were disregarded when baking NavMesh has been fixed for the next release of Unity.
Cheers.. /Jakob
Answer by Jakob_Unity · Jan 19, 2012 at 11:35 AM
An issue where terrain based trees were disregarded when baking NavMesh has been fixed. I expect this to be in for the next release of Unity 3.5.
Cheers.. /Jakob
Answer by Jakob_Unity · Jan 19, 2012 at 11:41 AM
The was an issue with trees in terrains being disregarded when baking navmesh. This has been fixed. Expect it for the next release of Unity3.5.
Cheers.. /Jakob
Great. I can't wait for the next release. Thanks for your help.