Pathing Issues with target outside navmesh

124 views
Skip to first unread message

FabioF.

unread,
Oct 3, 2012, 2:00:57 PM10/3/12
to recastnavigation
Hi everybody,
sorry if this seems like a very naive question, I have noticed that
when I try and set an agent to target a point that is way above my
navmesh (say for example on top of an high wall) it happens that
instead of pathing to the wall and then being stuck against it trying
to reach the target, sometimes the agent just wanders off on a route
that is the complete opposite of where I'd expect it to go and then
gets stuck on a random point in the middle of my navmesh... this seems
to happen only when I set the target for my agent above a certain
height on walls.. any Ideas on what could be happening or on how to
solve the issue?

thank you very much,
Fabio.

Mikko Mononen

unread,
Oct 3, 2012, 3:07:21 PM10/3/12
to recastna...@googlegroups.com
Hi,
If the path finder cannot reach target polygon, then it tries to go to
the "nearest location" next to the goal. This is not often what human
logic would choose.

Can you repro the problem in RecastDemo? If not, a picture which shows
duDebugDrawNavMeshNodes() would be really helpful to try to understand
what happens there.


--mikko

FabioF.

unread,
Oct 4, 2012, 12:27:30 PM10/4/12
to recastna...@googlegroups.com
Thank you Mikko,
I have noticed that issue only happens if set the target a certain height above the navmesh.. 
Also the ai seems to be always pathing to a specific point..no metter matter where you set the target.. it seems to be some default corridor that happens when something goes wrong when trying to find the path.

I took a couple screenshots, I don't know how helpful they are.. for now I've mitigated the issue by detecting if a target has been set too high.. hacky solution that seems to work but that doesn't make me feel good about myself at all :/

In this pic the yellow cross is the target and the path the agent has chosen is drawn in blue. Note that even if I set a "high" target anywhere else in the map the agents will always try returning to the same point! 


this is a view of the navmesh in the area


Thank you very much for your help (and all my admiration for your work!)
Fabio.

Mikko Mononen

unread,
Oct 5, 2012, 6:26:58 AM10/5/12
to recastna...@googlegroups.com
The case you describe should be handled just fine.

It is a bit hard to tell from the screen shots, so few more questions to narrow down the cause:
1) Do you use dtCrowd?
2) Is the "default location" close to 0,0,0?
3) Does the findNearestPoly() find polygon for you in case you set target on the wall?
4) What are the extents you pass to findNearestPoly(), and what are your world units? (i.e. how large is this box related to the game world)

--mikko

FabioF.

unread,
Oct 5, 2012, 11:22:03 AM10/5/12
to recastna...@googlegroups.com
I do use dtCrowd.
Yes the location is near to the world origin
The findNearestPoly does return a valid poligon that i then pass to the agent to set its target but that seems to lead to the same wierd result.
The world units are in centimeters. The extents of the box I've varied many times a good value seemed to be around 0.5, 1.0, 0.5 but i've tried a whole lot of other sizes...
also i've noticed that even when an agent does succeed to find a path to the wall, when i then set its target back to the player, for a brief moment, the path goes back to that default position and then changes to a path that actually leads to the player...
Unfortunately I do not have more time to dedicate to the issue so I'll have to live with my hacky solution :(

-Fabio. 

Mikko Mononen

unread,
Oct 5, 2012, 11:33:02 AM10/5/12
to recastna...@googlegroups.com
Hi,

The query box should be 2-4 times larger than your character. So if you're character is 60x60x200cm, then you could try for example 200x200x300 search box. It is important that it is big enough that it will always find a polygon, but not too big so that the internal buffer does not run out (it will visit at max 128 polygons).

I think I would need a bit debug help to get the odd behavior to fixed. Let me know if you want to take a look at it later.


--mikko

FabioF.

unread,
Oct 9, 2012, 5:42:51 AM10/9/12
to recastna...@googlegroups.com
Ok, 
Thanks again for your help Mikko!
Reply all
Reply to author
Forward
0 new messages