Nextbot Navmesh

I noticed that my Nextbots are not only moving in the navmesh. I removed some parts of the mesh were too many obstacles are and they frequently get stuck, but they run anyways in those places. So i inspected the problem an noticed that they are not really “using” the navmesh.
I placed a npc_tf2_ghost at the loction the courser points to. She directly went to the place on the image and crossed the boarder of the ending mesh.
Why? and how can i prevent this? Whats the point of the navmesh when the bots can walk around without their presence?

Uh. NextBot need navmesh for navigation. If there are no navigation. They can’t go anywhere.

Assuming you are using nav_generate. It can happens that either the navmesh make nextbots stucks or incorrects (nextbots can’t go to some locations)

If you want to remove a bad navarea. Use nav_delete (somethings like this).
Then don’t forget to use nav_save. And do nav_analyze.

It is due to how nextbots are coded. They CAN go outside of any nav area, however they are not expected or supposed to - it is a fault of the nextbot coding, not your navmesh.

Do not forget to nav_save the thing after you edit it though.

Thats exactly what i was doing, nav_generate, nav_delete the unwanted area, nav_save and nav_analyze.

That means i can not do anything about it? This seems to make the NextBot almost useless.

I just want to have some Bots wandering around and dont want them to get stuck in the next pond or something. I already check if their random destination is in a nav area, but it seems that it is also necessary to check if the path to this location is also leading through nav areas exclusively. if not, another random destination can be chosen.
Any suggestions how to determine if the path is good?

I think i had a similar problem if i understand you correctly months ago.

Here is my approach, I don’t know wether this is resource efficient or not but it works flawlessly.
You should probably change lookahead desiredspeed and maxage to your needs.

[LUA]function ENT:MoveSomeWhere(distance)
distance = distance or 1000
self.loco:SetDesiredSpeed( 100 )
local navs = navmesh.Find(self:GetPos(), distance, 120, 120)
local nav = navs[math.random(1,#navs)]
if !IsValid(nav) then return end
if nav:IsUnderwater() then return end – we dont want them to go into water
local pos = nav:GetRandomPoint()
local maxAge = math.Clamp(pos:Distance(self:GetPos())/120, 0.1,10)
self:MoveToPos( pos, { tolerance = 30, maxage = maxAge, lookahead = 10, repath = 2 })

function ENT:MoveToSpot( type )
local pos = self:FindSpot( “random”, { type = type, radius = 5000 } )
if ( pos ) then
local nav = navmesh.GetNavArea(pos, 20)
if !IsValid(nav) then return end
if !nav:IsUnderwater() then
self.loco:SetDesiredSpeed( 200 )
self:MoveToPos( pos, { tolerance = 30, lookahead = 10, repath = 2 } )

it works great, thank you very much.