- Home /
Navmesh Agents: Bad pathing, and walking into things
Hey there,
I was hoping that I could get some advice for some Navmesh Agent oddities that I'm getting.
The Navmesh is baked using all default settings, and using the new component based navmesh system, and I use a lot of carved non-moving obstacles.
The issue I'm getting are as follows: 1) My agents often times just get stuck in a spot and sway around wildly like they're tied to the end of a rope and cannot escape 2) They often times choose the most stupid path, and instead of going directly to a point will often go out of their way to double, or even triple the path by going around things. 3) They walk into my carved obstacles and just keep trying to move through it instead of going around.
The agents are set to medium for obstacle avoidance, and I change their priority using a coroutine every minute or so, which works really well to get them to avoid each other... They hardly ever walk into other agents, but very often will just sit their walking against a wall that has a carved obstacle on it.
It is probably worth noting that my script for controlling the Agents will get the closest point on the navmesh close to their destination, then calculate and set their path. Once their path is set I then run a coroutine that sets their destination vector every few seconds (in an attempt to stop it going bad), and then when they stop moving I check to make sure they're actually close to their destination, and if they're I set their destination vector again.
Has anyone got any advice for me? And perhaps a good method to make sure an agent does not get stuck.
Cheers!
I'm having the same issues. To avoid navmesh agents from getting stuck out of the navmesh (getting out of the navmesh completely) into obstacles I would make the obstacle uncarved, but now they choose to walk right into the obstacles and get stuck in the way (although they still have an open alternative path). I'm strongly thinking about using an alternative A* package
Your answer
![](https://koobas.hobune.stream/wayback/20220612130808im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Navigation Agent "Clipping" (Going inside) Navmesh Deadzone?... 1 Answer
Deleted component errors, yet component is still visible in inspector? 0 Answers
NavMesh Lookat causes jittery glitch in character 0 Answers
What is the difference between configuration of agent in 'Agents' tab and in 'Bake' tab Unity? 1 Answer
Can I have 2 navmeshes but only have 1 effected by a nav mesh obstacle? 0 Answers