Skip to content

Commit

Permalink
Fix MediaContent bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Nov 27, 2023
1 parent d2ea71e commit 50e0835
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/bit-systems/media-loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ function* finish(world: HubsWorld, mediaLoaderEid: EntityID) {
minHalfExtent: 0.04
});
}

addComponent(world, MediaContentBounds, mediaLoaderEid);
const mediaLoaderObj = world.eid2obj.get(mediaLoaderEid)!;
box.setFromObject(mediaLoaderObj);
box.getSize(tmpVector);
MediaContentBounds.bounds[mediaLoaderEid].set(tmpVector.toArray());
}

// TODO: Move to bit utils and rename
Expand Down Expand Up @@ -286,12 +292,6 @@ function* loadAndAnimateMedia(world: HubsWorld, mediaLoaderEid: EntityID, clearR

setNetworkedDataWithoutRoot(world, APP.getString(Networked.id[mediaLoaderEid])!, mediaEid);

addComponent(world, MediaContentBounds, mediaLoaderEid);
const mediaObj = world.eid2obj.get(mediaEid)!;
box.setFromObject(mediaObj);
box.getSize(tmpVector);
MediaContentBounds.bounds[mediaLoaderEid].set(tmpVector.toArray());

removeComponent(world, MediaLoading, mediaLoaderEid);
removeComponent(world, MediaLink, mediaLoaderEid);
}
Expand Down

0 comments on commit 50e0835

Please sign in to comment.