Navigation plugin generated mesh rotated 180 degrees around y axis

Hi

My model should not have any transforms on them. For some reason when I generate the debug mesh I need to rotate it 180 degrees around y axis to align with the source model.

updateNavMesh(): void {
    const startTime = new Date().getTime();
    this.navigationPlugin.createNavMesh(this.floorMeshes, {
        cs: 0.3,
        ch: 0.2,
        walkableSlopeAngle: 45,
        walkableHeight: 1,
        walkableClimb: 1,
        walkableRadius: 1,
        maxEdgeLen: 12.,
        maxSimplificationError: 1.3,
        minRegionArea: 4,
        mergeRegionArea: 20,
        maxVertsPerPoly: 6,
        detailSampleDist: 6,
        detailSampleMaxError: 1,
    });
    const navigationDebugMesh = this.navigationPlugin.createDebugNavMesh(this.scene);
    navigationDebugMesh.rotation.y = Math.PI;
    const navigationDebugMaterial = new BABYLON.StandardMaterial('navigation-debug-material', this.scene);
    navigationDebugMaterial.diffuseColor = new BABYLON.Color3(0.1, 0.2, 1);
    navigationDebugMaterial.alpha = 0.2;
    navigationDebugMesh.material = navigationDebugMaterial;

    console.log("Nav mesh calculation took: " + (new Date().getTime() - startTime) + " ms.");
}

Any idea what could be wrong?

"babylonjs": "4.2.0-alpha.11",
"babylonjs-loaders": "4.2.0-alpha.11",
"recast-detour": "^1.1.0",

Kind regards,
Tommi

Hi Tommi,

Do you have a playground that highlights the issue? It might a transform that’s not supported when baking the geometry at some point.

1 Like

Hi Cedric

Thank you for the response. I am loading the model with GLTF model, then instantiating it with instantiateHierarchy and finally using created instance as floor mesh for createNavMesh. Perhaps something in this process introduces something or alternatively Blender export introduces some GLTF specific transformations. On blender side I have applied all transforms to mesh. I am quite tight on time at the moment but I need to debug this at some point and maybe I can create playground too.

Kind regards,
Tommi

1 Like