swordlegend / recastnavigation

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

default SAMPLE_POLYAREA_GROUND makes holes #141

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
hi, i wonder if all the area id is avalible, for example , i use 
SAMPLE_POLYAREA_GROUND to mark the area, hard code as below:

rcMarkConvexPolyArea(m_ctx, vols[i].verts, vols[i].nverts, vols[i].hmin, 
vols[i].hmax,SAMPLE_POLYAREA_GROUND/* (unsigned char)vols[i].area*/, *m_chf);

the area would become a hole.

is that as expected? 

now i want to use the convex to make an area, just want to spilt the poly, in 
order to change its area dynamicaly. 

thank you 

Original issue reported on code.google.com by zhibin.l...@gmail.com on 5 Nov 2010 at 6:05

GoogleCodeExporter commented 9 years ago
the piture shows the situation.
thanks

Original comment by zhibin.l...@gmail.com on 5 Nov 2010 at 6:12

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

There is a catch! :) There are two special area ids : RC_NULL_AREA (0), and 
RC_WALKABLE_AREA (63).

By default, all walkable spans are marked as RC_WALKABLE_AREA and unwalkable 
are marked as RC_NULL_AREA. Those are special case IDs in Recast, Detour does 
not have such restrictions.

SAMPLE_POLYAREA_GROUND happens to be 0. That is why it is treated as a hole. 
There is historical reason why it is that way. I wanted to keep the navmesh 
color to be blue when no area is marked (the navmesh draw function draws polys 
with 0 id as blue). There is a piece of code at the end of the navmesh build 
process, which matches the generation time areas to runtime areas [1].

So, the solution is to use id in range [1..62] for custom areas.

--mikko

[1] 
http://code.google.com/p/recastnavigation/source/browse/trunk/RecastDemo/Source/
Sample_TileMesh.cpp#1114

Original comment by memono...@gmail.com on 5 Nov 2010 at 7:54

GoogleCodeExporter commented 9 years ago

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