From c23b7d4c913b33f184adc46ea1608c7a863d5bf7 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Wed, 8 May 2024 10:36:15 +0200 Subject: [PATCH] Add warning for negative scale when creating interactables bounds --- src/bit-systems/interactable-system.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bit-systems/interactable-system.ts b/src/bit-systems/interactable-system.ts index 309f5600ec..d7aa7e3442 100644 --- a/src/bit-systems/interactable-system.ts +++ b/src/bit-systems/interactable-system.ts @@ -29,9 +29,13 @@ export function interactableSystem(world: HubsWorld) { // If it has media frame collision mask, it needs to have content bounds if (hasMesh && Rigidbody.collisionFilterMask[eid] & COLLISION_LAYERS.MEDIA_FRAMES) { const box = getBox(obj, obj); - box.getSize(tmpVector); - addComponent(world, MediaContentBounds, eid); - MediaContentBounds.bounds[eid].set(tmpVector.toArray()); + if (!box.isEmpty()) { + box.getSize(tmpVector); + addComponent(world, MediaContentBounds, eid); + MediaContentBounds.bounds[eid].set(tmpVector.toArray()); + } else { + console.error(`Couldn't create content bounds for entity ${eid}. It seems to be empty or have negative scale.`); + } } }); }