Skip to content

Commit c23b7d4

Browse files
committed
Add warning for negative scale when creating interactables bounds
1 parent ae050ee commit c23b7d4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/bit-systems/interactable-system.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ export function interactableSystem(world: HubsWorld) {
2929
// If it has media frame collision mask, it needs to have content bounds
3030
if (hasMesh && Rigidbody.collisionFilterMask[eid] & COLLISION_LAYERS.MEDIA_FRAMES) {
3131
const box = getBox(obj, obj);
32-
box.getSize(tmpVector);
33-
addComponent(world, MediaContentBounds, eid);
34-
MediaContentBounds.bounds[eid].set(tmpVector.toArray());
32+
if (!box.isEmpty()) {
33+
box.getSize(tmpVector);
34+
addComponent(world, MediaContentBounds, eid);
35+
MediaContentBounds.bounds[eid].set(tmpVector.toArray());
36+
} else {
37+
console.error(`Couldn't create content bounds for entity ${eid}. It seems to be empty or have negative scale.`);
38+
}
3539
}
3640
});
3741
}

0 commit comments

Comments
 (0)