{"record":{"id":"688fad56072f618b","repo":"BabylonJS/Babylon.js","slug":"unable-to-generatesolonavmesh-result-error","errorCode":null,"errorMessage":"Unable to generateSoloNavMesh: ${result.error}","messagePattern":"Unable to generateSoloNavMesh: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/addons/src/navigation/generator/generator.single-thread.ts","lineNumber":59,"sourceCode":"    const tileSize = parameters.tileSize ?? 0;\n    const needsTileCache = (parameters.maxObstacles ?? 0) > 0;\n    const needsTiledNavMesh = tileSize > 0;\n    if (needsTileCache) {\n        if (tileSize < 32 || tileSize > 64) {\n            Logger.Warn(\"NavigationPlugin: Tile cache is enabled. Recommended tileSize is 32 to 64. Other values may lead to unexpected behavior.\");\n        }\n    }\n\n    // Create the appropriate configuration based on the parameters\n    const config = needsTileCache ? CreateTileCacheNavMeshConfig(parameters) : needsTiledNavMesh ? CreateTiledNavMeshConfig(parameters) : CreateSoloNavMeshConfig(parameters);\n    const result = needsTileCache\n        ? recast.generateTileCache(positions, indices, config as TileCacheGeneratorConfig, parameters.keepIntermediates)\n        : needsTiledNavMesh\n          ? recast.generateTiledNavMesh(positions, indices, config as TiledNavMeshGeneratorConfig, parameters.keepIntermediates)\n          : recast.generateSoloNavMesh(positions, indices, config as SoloNavMeshGeneratorConfig, parameters.keepIntermediates);\n\n    if (!result.success) {\n        throw new Error(`Unable to generateSoloNavMesh: ${result.error}`);\n    }\n\n    return {\n        navMesh: result.navMesh,\n        intermediates: result.intermediates,\n        navMeshQuery: new recast.NavMeshQuery(result.navMesh),\n        tileCache: \"tileCache\" in result ? result.tileCache : undefined,\n    };\n}\n","sourceCodeStart":41,"sourceCodeEnd":69,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/addons/src/navigation/generator/generator.single-thread.ts#L41-L69","documentation":"After dispatching to the Recast WASM generator (solo, tiled, or tile cache depending on parameters), GenerateNavMesh() checks result.success and throws if the underlying @recast-navigation generator reported failure (generator.single-thread.ts:59). The message template says \"generateSoloNavMesh\" even for tiled/tile-cache paths, but result.error carries the actual Recast failure reason. This indicates Recast could not build a valid nav mesh from the provided geometry/config — e.g. invalid parameters, geometry outside the tile/bounds extents, or an internal Recast error.","triggerScenarios":"parameters.tileSize > 0 with geometry extents incompatible with the tile config; maxObstacles > 0 with tileSize outside the recommended 32–64 range; SoloNavMeshGeneratorConfig values (cellSize, agentRadius, agentHeight, agentMaxClimb, bounds) too large/small or misaligned for the scene scale; geometry with degenerate/inverted triangles; doNotReverseIndices set wrong so triangles have incorrect winding and Recast culls them all; Recast internal errors reported via result.error.","commonSituations":"Scene scaled very differently from Recast defaults (tiny or huge units) making cellSize/agent values nonsensical; wrong triangle winding after exporting from a DCC tool without the doNotReverseIndices flag; tileSize/maxObstacles combinations warned about at line 46 but not fatal until generation; copying config from another project whose scene scale differs.","solutions":["Read result.error in the message for the actual Recast cause and fix that specific issue first","Check triangle winding: if the nav mesh comes out empty, set doNotReverseIndices: true (or remove it) in INavMeshParametersV2 to match your mesh winding","Keep tileSize in the recommended 32–64 range when using tile cache (maxObstacles > 0), as warned at generator.single-thread.ts:46","Validate your config scale: cellSize/cellHeight/agentRadius/agentHeight/agentMaxClimb and the bounds must match your scene units","Simplify: try generating a solo nav mesh (no tileSize, no maxObstacles) on a single simple mesh to isolate whether the issue is config or geometry"],"exampleFix":"// before\nplugin.createNavMesh(meshes, {\n    tileSize: 128,          // outside recommended range for tile cache\n    maxObstacles: 10,\n    doNotReverseIndices: true, // wrong for this winding\n});\n\n// after\nplugin.createNavMesh(meshes, {\n    tileSize: 64,               // within recommended 32-64\n    maxObstacles: 10,\n    doNotReverseIndices: false, // correct winding for the source meshes\n});","handlingStrategy":"validation","validationCode":"function validateNavMeshParameters(p: INavMeshParametersV2) {\n    const tileSize = p.tileSize ?? 0;\n    if ((p.maxObstacles ?? 0) > 0 && (tileSize < 32 || tileSize > 64)) {\n        throw new Error(\"tileSize must be 32-64 when maxObstacles > 0\");\n    }\n    if (!p.cellSize || p.cellSize <= 0 || !p.agentRadius || p.agentRadius <= 0) {\n        throw new Error(\"Invalid nav mesh config: cellSize/agentRadius must be positive\");\n    }\n}","typeGuard":"function isGenerationSuccess(r: { success: boolean; error?: string }): r is { success: true; error?: never } {\n    return r.success === true;\n}","tryCatchPattern":"try {\n    const { navMesh, navMeshQuery } = GenerateNavMesh(meshes, parameters);\n} catch (e) {\n    if (e instanceof Error && e.message.startsWith(\"Unable to generateSoloNavMesh\")) {\n        console.error(\"Recast failed:\", e.message);\n        // retry with corrected winding: parameters.doNotReverseIndices = !parameters.doNotReverseIndices\n    }\n}","preventionTips":["Match doNotReverseIndices to your meshes' actual triangle winding; flip it if generation fails or the mesh comes out empty","Keep tileSize within 32-64 when using tile cache (maxObstacles > 0)","Tune cellSize/cellHeight/agent* values to your scene's units; avoid copying configs between differently scaled projects","Test with a simple solo nav mesh on one mesh to isolate config vs geometry issues","Read result.error from the thrown message — it names the specific Recast failure"],"tags":["navigation","recast","navmesh","wasm","configuration"],"backgroundTag":"navmesh-generation-failed","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}