0
我正在製作一個3d json模型的副本,我已經動畫了,如果我在場景中只有1個模型,它就可以工作。Threejs克隆網格動畫
但是,當我試圖做一些副本,它出現以下錯誤:
遺漏的類型錯誤:無法讀取的未定義的屬性「0」。
下面的函數是在錯誤的引用到:
for(i =0; i < enemics_generats; i++){
var enemic = dolent.clone(true); //Clone from original model
enemic.name = i.toString();
if (i > 5){//set 5 visible, the rest invisble
enemic.visible = false;
}
else{
enemic.visible = true;
}
enemic.box = new THREE.Box3().setFromObject(enemic);//Box collider
enemic.box_helper = new THREE.BoxHelper(enemic); //Box to be displayed on the scene
//ERROR IS ON THIS 2 FOLLOWING LANES
enemic.mixer = new THREE.AnimationMixer(enemic);
enemic.mixer.clipAction(enemic.animations[ 0 ]).play(); //HERE IS WHERE THE ERROR APPEARS
enemics.push(enemic);//Add to the array
scene.add(enemic);//Add to scene
scene.add(enemic.box_helper);
}
感謝您的時間。
如果你的動畫特性或功能的定義。 –
JSON加載器從文件讀取動畫,並將它們存儲在動畫屬性中。 –
所以,「dolent」(它是原始的加載模型)在裏面有動畫。 –