Hello I am still quite inexperienced with ThreeJS and am just playing with it. I have looked at theverse tutorials and am already loading glb files and rendering them in the browser. This is all working very well.
I have loaded a GLB file from https://sketchfab.com/ in which 8 different human bodies are shown. I want to display only one body at a time depending on the situation.
My question is, is this possible ? Is it possible to select the individual models in the file and add them. Or do I have to cut the glb file with e.g. Blender for this to work?
I tried to access with o.Children after loading the glb file but there was not this tried. Also, o.scene.length = 1
I could just solve the problem myself
Here in this a link is described again how the file is loaded. There is also an example how to load single objects.
With the following command a single object can be selected:
const gltfLoader = new GLTFLoader();
gltfLoader.load('resources/models/cartoon_lowpoly_small_city_free_pack/scene.gltf', (gltf) => {
const root = gltf.scene;
cars = root.getObjectByName('Cars');
scene.add(cars)
});
With "scene.add(cars)" only this object is added now