diff --git a/src/bit-systems/audio-debug-system.ts b/src/bit-systems/audio-debug-system.ts index 92fd151b07..a14964fa76 100644 --- a/src/bit-systems/audio-debug-system.ts +++ b/src/bit-systems/audio-debug-system.ts @@ -119,7 +119,9 @@ getScene().then(() => { const addDebugMaterial = (world: HubsWorld, navEid: number) => { const obj = world.eid2obj.get(navEid); if (obj) { - const navMesh = obj as Mesh; + // Some older scenes have the nav-mesh component as an ancestor of the mesh itself + // TODO the "as any" here is because of incorrect type definition for getObjectByProperty. It was fixed in r145 + const navMesh = obj.getObjectByProperty("isMesh", true as any) as Mesh; navMesh.visible = isEnabled; if (nav2mat.has(navEid)) return; nav2mat.set(navEid, navMesh.material); @@ -132,7 +134,9 @@ const addDebugMaterial = (world: HubsWorld, navEid: number) => { const removeDebugMaterial = (world: HubsWorld, navEid: number) => { const obj = world.eid2obj.get(navEid); if (obj) { - const navMesh = obj as Mesh; + // Some older scenes have the nav-mesh component as an ancestor of the mesh itself + // TODO the "as any" here is because of incorrect type definition for getObjectByProperty. It was fixed in r145 + const navMesh = obj.getObjectByProperty("isMesh", true as any) as Mesh; navMesh.visible = false; if (!nav2mat.has(navEid)) return; navMesh.material = nav2mat.get(navEid)!;