[go: up one dir, main page]

getBoundingBox on 3dtiles returns infinity when only tileset.json is loaded

Summary

The getBoundingBox method of Tiles3D returns a bounding box only when some tiles are already loaded. Until then (i.e. when only tileset.json is loaded, like when the entity is out of view), the bounding box is infinite. This affects IFCs and PointClouds.

image

This is problematic in Piero, where we use that bounding box for zooming into an entity: while a Tiles3D is out of view, we cannot zoom to it.

Steps to reproduce

  1. Patch examples/3dtiles_building.js:
diff --git a/examples/3dtiles_building.js b/examples/3dtiles_building.js
index fb42d105..04444f12 100644
--- a/examples/3dtiles_building.js
+++ b/examples/3dtiles_building.js
@@ -88,6 +88,10 @@ function initializeCamera() {
 
     instance.add(grid);
     grid.updateMatrixWorld(true);
+
+    console.log('Tileset loaded', ifc.getBoundingBox());
+
+    setTimeout(() => console.log('After 100ms', ifc.getBoundingBox()), 100);
 }
  1. Run the example

Expected behaviour: both console.log should print the whole bounding box of the tileset

Actual behaviour: first console.log prints an infinite bounding box.

Informations

  • Giro3D version: v0.39.0, ca61133c
  • Browser (Firefox, Chrome, Opera, Safari...) and version: FF
  • OS (Linux, MacOS, Windows...): Linux