threejs.miniprogram icon indicating copy to clipboard operation
threejs.miniprogram copied to clipboard

无法使用onProgress监听模型加载进度

Open dadwadw233 opened this issue 3 years ago • 0 comments

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' );
  },);

dadwadw233 avatar Jun 27 '22 17:06 dadwadw233