let my_model;
let gltfLoader = new GLTFLoader()
gltfLoader.setDRACOLoader(dracoLoader)
gltfLoader.load(
'/models/aws.glb',
(gltf) =>
{
my_model = gltf.scene;
my_model.scale.set(1, 1, 1);
my_model.name = 'my_identificator';
scene.add(my_model)
}
)
then you will have access to your model like this:
scene.getObjectByName( ‘my_identificator’)
Now you have to linking the separate meshes to control them. I don’t know your model structure - maybe it contains more groups or submeshes, but you can anyway detecting any mesh using function traverse()
// for example:
my_model.traverse(function(element){
if(element.isMesh){
element.name = 'submesh_unique_identificator';
}
});
this way you will have guaranteed links to submeshes and access: scene.getObjectByName( ‘submesh_unique_identificator’)