- Home /
NavMesh Agent glitches in trees
Sometimes my navmesh agents get stuck in trees like this:
I set agent's destination only once through script. So far I have tried changing agent's paremeters, turning on/off auto traverse off mesh, auto repath and also changing navmesh surface voxel size. Does anyone have an idea what can cause this thing? Here are my agent settings:
and surface settings
Answer by tormentoarmagedoom · Apr 10, 2018 at 08:41 AM
Good day.
How many NavMeshAgents do you have in the scene? Somethimes, if too many navmeshagents, all ttrying to recalculate paths, make some of them act strange, but only for some seconds...
I have some experience with navmesh system, and when i see this gif, i think the object is trying to reach the tree, like Destination==ThatTree.
So, confimr whats the destination, and how many active navmesh agents you have in the scene.
Bye!
Hello!
The maximum amount of agents active at the same time is around 50-60, doesn't sound like too many to me. Plus I don't call SetDestination on them every frame, but only when I need it, so I don't think thats the issue. The destination is not a tree but some completely different place on the other part of the scene.
And they can never get out of this state, the only way to stop it right now is to manually move them away from trees which is obviously not an option.
Anyways, thanks for trying to help!
And maybe the height of the agent is collisiong with the tree leafs, change the naveshagent height (or do higher palm trees) to check if is this.
Lets see if is that....
Leaves have no navmesh geometry at all.
Answer by Rahd · Apr 11, 2018 at 02:34 AM
select trees and make them unwalkable . scale the tree collider to cover the roots , obstacle avoidance need to be smaller so play with the Radius .and btw make it low quality
Trees ARE unwalkable, because they have unwalkable Nav$$anonymous$$esh$$anonymous$$odifier. Every tree has a box collider (you can see it in the gif), that only covers a trunk and not leaves. I've tried changing radius and quality but that didn't help.
Like I said, navmesh agents can pass through any collider if it doesn't have navmesh obstacle component attached and navmesh geometry allows it. Changing tree collider did not help.
The gif shows that the obstacle avoidance Collider is moving around the tree collider you have not provided detail about your script or AI , my Ai has a navmesh agents and avoids colliders , and can go off the baked navigation plane. what i see is the AI is trying to go around the tree ignoring the collider because it's too small . or some kind of a bug that makes the Ai bugs out . i had this with doors inside houses the Ai will keep doing the same thing in the gif , the way i fixed it was to make the baked nav mesh more precise , and obstacle avoidance tweaks. i'm just trying to help . one thing can clear this out , is to debug the path of the AI . by drawing the path in the editor .
Answer by undersun · Mar 01, 2019 at 07:45 PM
Had similar issue, only workaround I found for it is to set destination every frame.