object.updateWorldMatrix is not a function
It looks like the errors is occurring here:
const box = new THREE.Box3().setFromObject(object);
Where object
is the object coming back from the call to GLTFLoader.load
.
According to the docs, object
is not an Object3D
(which is what Box3.setFromObject
expects).
Instead, object
is a JSON structure containing information about the GLTF data. The three.js example suggests object.scene
would be a renderable entity (if it exists).
Take a look at the code for the GLTFLoader
example, here. Compare it against your implementation. You can also debug your code to see exactly what is object
contains. Once you have a handle on that, if you're still having problems, come back and ask more questions!