Replies: 2 comments 5 replies
-
This issue tracks supporting this in recast-navigation-js, there hasn't been any progress though: #17 I've also done some searching for common wisdom on how this is done with detour, and haven't found much. Most have worked around this by running their existing navmesh triangles through recast. This isn't ideal but works fine for many cases. Using a non-recast navmesh with detour is possible, you'd need to construct detour dtNavMeshCreateParams yourself instead of constructing it with recast. Related: https://github.com/isaac-mason/recast-navigation-js/blob/main/packages/recast-navigation-generators/src/generators/generate-solo-nav-mesh.ts#L353 It's not straightforward though, the data that detour requires is fairly coupled to what recast generates. In particular, recast generates & detour works with both a simple polygon mesh representation, and a detailed mesh representation that contains more accurate height data. This article gives a good overview: https://www.unrealdoc.com/p/navigation-mesh I imagine most people wanting to use an existing navmesh with detour already have the detailed mesh representation. Maybe if it's straightforward to generate the simple polygon mesh representation a generic utility could be added to recast-navigation-js The current recast-navigation-js bindings also don't make it easy to interact with dtNavMeshCreateParams. We could extend DetourNavMeshBuilder to support building navMeshCreateParams without recast structures, maybe using the Array wrappers. Currently there's only methods that take rcPolyMesh and rcPolyMeshDetail: // https://github.com/isaac-mason/recast-navigation-js/blob/d3adca721ce1993976d4cc01881a61e76e9ecec3/packages/recast-navigation-wasm/src/Detour.cpp#L3
void DetourNavMeshBuilder::setPolyMeshCreateParams(dtNavMeshCreateParams *navMeshCreateParams, rcPolyMesh *polyMesh)
{
navMeshCreateParams->verts = polyMesh->verts;
navMeshCreateParams->vertCount = polyMesh->nverts;
navMeshCreateParams->polys = polyMesh->polys;
navMeshCreateParams->polyAreas = polyMesh->areas;
navMeshCreateParams->polyFlags = polyMesh->flags;
navMeshCreateParams->polyCount = polyMesh->npolys;
navMeshCreateParams->nvp = polyMesh->nvp;
rcVcopy(navMeshCreateParams->bmin, polyMesh->bmin);
rcVcopy(navMeshCreateParams->bmax, polyMesh->bmax);
}
void DetourNavMeshBuilder::setPolyMeshDetailCreateParams(dtNavMeshCreateParams *navMeshCreateParams, rcPolyMeshDetail *polyMeshDetail)
{
navMeshCreateParams->detailMeshes = polyMeshDetail->meshes;
navMeshCreateParams->detailVerts = polyMeshDetail->verts;
navMeshCreateParams->detailVertsCount = polyMeshDetail->nverts;
navMeshCreateParams->detailTris = polyMeshDetail->tris;
navMeshCreateParams->detailTriCount = polyMeshDetail->ntris;
} |
Beta Was this translation helpful? Give feedback.
-
Related google discussion: https://groups.google.com/g/recastnavigation/c/nrYwdskj8E8/m/UjIHXXkvBAAJ |
Beta Was this translation helpful? Give feedback.
-
In my use-case I can already construct nice triangulations using
triangle-wasm
, purely in the XZ plane.Is there any way to skip Recast's triangulation-generation, and construct tiles from a custom triangulation?
It seems natural to want to control the triangulation, either totally, or to some extent.
But I wonder whether I'm barking up the wrong tree, because I don't find any clear references online.
Beta Was this translation helpful? Give feedback.
All reactions