Skip to content

Commit

Permalink
Find the right mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Oct 13, 2023
1 parent 0fffde6 commit 5fc0b0c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bit-systems/audio-debug-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)!;
Expand Down

0 comments on commit 5fc0b0c

Please sign in to comment.