Still, a single object will be created including everything in a single “package”
(animations, geometries or whatever it could find inside your file)
It’s a personal view. But I suggest to not add complete gltf.scene, as it could become a hassle to target and manage specific parts of your loaded files.
many variations exists, depends your needs.
The most common way is to traverse the gltf.scene and look for specific content.
But beware about special cases like animations: they are stored at the root of the object.
A basic function to get all the mesh inside your file:
gltfLoader.load(something, function(gltf) {
const content = gltf.scene;
content.traverse(function(child) {
if (child.isMesh) {
//retrieve geometry/map/skeleton or whatsoever here...
}
});
});
Just in case you are unsure where stuff is stored.
output the whole gltf in the console.log , and check manually.
I’d note that the gltf.scene object is actually a THREE.Group. It represents the contents of a “scene” declared in the glTF file but doesn’t need to be used that way in your application.
I do not recommend just grabbing the first child of the group unless you’re very sure about the exact content of your model. If you discard parent objects, you may also be discarding the position/rotation/scale that would be necessary for the objects to appear in the right locations.