yannliao / threejs.miniprogram

JavaScript 3D library. Three.js for wechat miniprogram
https://yannliao.github.io/threejs.miniprogram/
MIT License
401 stars 151 forks source link

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

Open dadwadw233 opened 2 years ago

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