Three.js加载fbx模型

时间:2020-11-10 16:16:56

标签: three.js

我使用了教程中的一些示例,无法理解此错误。 我的纹理文件路径位于“ models / Textures /”中,我的fbx文件路径位于“ models /”中,并进行编程以自动搜索fbx文件路径中的纹理。如何设置此fbx模型的纹理的路径?

error: Uncaught TypeError: material.customProgramCacheKey is not a function

我的代码:

const loader = new FBXLoader();    
loader.setPath('assets/models/');
loader.load( 'Drone.fbx', (object) => {
mixer = new THREE.AnimationMixer( object );
    
const action = mixer.clipAction( object.animations[ 0 ] );
action.play();
    
object.traverse( ( child ) => {
   if (child.isMesh) {
      child.material.transparent = false;
      child.material.alphaTest = 0.5;
   }
});

scene.add(object);
    
}, undefined, e => {
   console.error(e);
});

0 个答案:

没有答案