got this example from Michael, great got so far ,
got this working , but the rotation has gone funky , and some instances missing materials and showing wireframes ?
const gltfProjectLoader = new GLTFLoader(manager);
var dummy = new THREE.Object3D();
gltfProjectLoader.load('models/projectsModel.glb', function (gltf) {
rootProjects = gltf.scene;
projectsObj = rootProjects;
projectsObj.getObjectByName("gltf_object_name");
gltf.scene.traverse( function ( child ) {
if ( child.isMesh ) {
for ( let i = 0; i < 50; i ++ ) {
instancedGeo = new THREE.InstancedMesh(child.geometry, child.material, 1);
instancedGeo.setMatrixAt( 0, dummy.matrix );
instancedGeo.position.x = getRandomFloatInclusive(100, -200) ;
instancedGeo.position.y = getRandomFloatInclusive(100, -200) ;
instancedGeo.position.z = getRandomFloatInclusive(-10, -100);
instancedGeo.scale.x = instancedGeo.scale.y = instancedGeo.scale.z = Math.random() * 3 + 1;
pointsGltf.push(instancedGeo);
instancedGeo.needsUpdate = true;
scene.add(instancedGeo);
}
}
});
});