I store the location of each component of the gltf and merge the components of the same material into the same instancedMesh, but why is the final model scattered

I’m sorry that we can’t upload the final model image. The final effect is like an explosion diagram. Every component is scattered, which is not what we want

I would be very grateful if you could help me

```
loader.load(
href,
function(gltf){
let model = gltf.scene;
let meshArr = [];
model.traverse(function (child) {
if(child.isMesh) {
meshArr.push(child);
}
});
let structMap = new Map();
let posMap = new Map();
meshArr.foreach(function (element){
element.geometry.computeBoundingBox();
let objPosition = new THREE.Vector3();
objPosition.addVectors(
element.geometry.boundingBox.min,
element.geometry.boundingBox.max,
);
element.updateMatrixWorld();
element.geometry.applyMatrix4(element.matrixWorld);
if(structMap.has(element.material.name)) {
let sameMesh = structMap.get(element.material.name);
sameMesh.push(element);
structMap.set(element.material.name, sameMesh)
} else {
let sameMesh = [];
sameMesh.push(element);
structMap.set(element.material.name, sameMesh)
}
if(posMap.has(element.material.name)) {
let sameMesh = posMap.get(element.material.name);
sameMesh.push(element);
posMap.set(element.material.name, sameMesh)
} else {
let sameMesh = [];
sameMesh.push(element);
posMap.set(element.material.name, sameMesh)
}
});
}
```

```
var dummy = new THREE.Object3D();
for(let item of structMap) {
let key = item[0];
let value = item[1];
let posArr = [];
for(let posItem of posMap) {
if(posItem[0] === key) {
posArr = posItem[1];
}
}
if(posArr.length === 0) break;
value[0].geometry.computeVertexNormals();
const mesh = new THREE.InstancedMesh(value[0].geometry, value[0].material, value.length);
for(let i = 0; i<value.length; i++){
dummy.position.copy(posArr[i]);
dummy.updateMatrix();
mesh.setMatrixAt(i,dummy.matrix);
}
scene.add(mesh);
}
```