MachoChen / recastnavigation

Automatically exported from code.google.com/p/recastnavigation
zlib License
0 stars 0 forks source link

findNearestPoly doesn't work properly with large search box extents #137

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I tried using findNearestPoly with a search box of dimensions 20,20,20 and it 
would return a "nearest poly" and "nearest position" that were clearly wrong. 
Lowering the size of the search box to 5,20,5 fixed the problem. But it forces 
me to do a second query with a larger search box if the first one fails.

Original issue reported on code.google.com by daniel.a...@gmail.com on 29 Oct 2010 at 2:19

GoogleCodeExporter commented 8 years ago
You should keep the search box as small as possible at all times. If even 
2,10,2 will work most of the time, then you should use that and i.e. double the 
area if no polygons found. That "did not find any polys" case is a lot faster 
than trying to process a lot of excess polygons each time.

Internally findNearestPoly() processes max 128 polygons at a time. That is a 
lot to process. That limitation probably explains what you are experiencing. My 
suggestion is to expand the search radius when no polys are found as per above 
example.

Original comment by memono...@gmail.com on 29 Oct 2010 at 9:28

GoogleCodeExporter commented 8 years ago
Okay, I ended up doing just that (although I thought I was working around the 
issue, not that that would be the expected way to use it). Perhaps it would be 
helpful to point out this limitation in the function's documentation so others 
don't trip on the same stone.

Thanks for your help. And thanks for this awesome library, it's really 
admirable all the work you've put into it. Hopefully as I get more acquainted 
with it I'll be able to contribute something back.

Original comment by daniel.a...@gmail.com on 29 Oct 2010 at 11:33

GoogleCodeExporter commented 8 years ago

Original comment by memono...@gmail.com on 21 Nov 2010 at 2:55