Open dadwadw233 opened 2 years ago
gltfLoader.load(url, (gltf) => { console.log("strat to load model"); const root = gltf.scene; scene.add(root); root.updateMatrixWorld(); const box = new THREE.Box3().setFromObject(root); const boxSize = box.getSize(new THREE.Vector3()).length(); const boxCenter = box.getCenter(new THREE.Vector3()); frameArea(boxSize * 0.5, boxSize, boxCenter, camera); controls.maxDistance = boxSize * 100; controls.target.copy(boxCenter); controls.update(); getChild(); return "ok" }, onProgress=function ( xhr ) { console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' ); },);