I’d like to get the bounding box and ultimately the center of each child mesh in a gltf model file. I’ve used various code samples to find the computed bounding box of each child mesh in the gltf model but they all return the bounding box of the whole model group. I’ve attached a simple .gltf file and an image of the resulting model view in the browser.

One code block came from

[Bounding box is calculated wrong?]

Here are the variations I used but they all produce the same bounding box dimensions.

```
scene.add(model);
const helper = new THREE.BoxHelper(model);
helper.geometry.computeBoundingBox();
console.log(helper.geometry.boundingBox);
const helper2 = new THREE.BoxHelper(model.children[0].children[0]);
helper2.geometry.computeBoundingBox();
console.log(helper2.geometry.boundingBox);
const helper3 = new THREE.BoxHelper(model.children[0].children[1]);
helper3.geometry.computeBoundingBox();
console.log(helper3.geometry.boundingBox);
model.children[0].children[0].geometry.computeBoundingBox();
console.log(model.children[0].children[0].geometry.boundingBox);
model.children[0].children[1].geometry.computeBoundingBox();
console.log(model.children[0].children[1].geometry.boundingBox);
console.log(new THREE.Box3().setFromObject(model.children[0].children[0]));
// discourse.threejs.org/t/bounding-box-is-calculated-wrong/1763/5
var boundingBox = new THREE.Box3();
var mesh = model.children[0].children[1];
boundingBox.copy(mesh.geometry.boundingBox);
mesh.updateMatrixWorld(true); // Ensure world matrix is up to date
boundingBox.applyMatrix4(mesh.matrixWorld);
console.log(boundingBox);
```

Mugen87 made the comment “Be aware that geometries can be shared across meshes. So the behavior of the library is actually correct.” I don’t know if the comment applies here.

How can I retrieve the unique bounding box – and center – of each child BufferGeometry in a gltf model?

Blocks.gltf (5.7 KB)