I receive this error at console.log(error)
line , I don’t have any idea why I receive this log at this line.
(The model is not visible in the scene too)
function loadCube() {
// // Optional: Provide a DRACOLoader instance to decode compressed mesh data
// THREE.DRACOLoader.setDecoderPath("js/draco/gltf");
// loader.setDRACOLoader(new THREE.DRACOLoader());
// // Optional: Pre-fetch Draco WASM/JS module, to save time while parsing.
// THREE.DRACOLoader.getDecoderModule();
loader.load("animations/cube/cube.gltf", function (gltf) {
console.log(gltf.scene);
const mesh = gltf.scene;
mesh.scale.set(10, 10, 10);
const bodies = [];
const tails = [];
const headDecorations01 = [];
const headDecorations02 = [];
const eyes01 = [];
const eyes02 = [];
const skinnedMeshesParent = mesh.children[0].children[0].children[0];
initMeshes(bodies, skinnedMeshesParent.children[1], true);
initBodiesMaterial(bodies, skinnedMeshesParent.children[1]);
console.log(skinnedMeshesParent.children[1].name);
initMeshes(tails, skinnedMeshesParent.children[0], true);
initBodyPartsMaterial(tails, skinnedMeshesParent.children[0],
"textures/cube/tails/Tails", true);
console.log(skinnedMeshesParent.children[0].name);
const bodyPartsParent = mesh.children[0].children[0].children[1].children[0].children[1].children[0].children[0].children[1];
initMeshes(headDecorations01, bodyPartsParent.children[0].children[0], true);
initBodyPartsMaterial(headDecorations01, bodyPartsParent.children[0].children[0],
"textures/cube/headDecorations/Hornsearsantenas01", false);
console.log(bodyPartsParent.children[0].children[0].name);
initMeshes(headDecorations02, bodyPartsParent.children[0].children[1], true);
initBodyPartsMaterial(headDecorations02, bodyPartsParent.children[0].children[1],
"textures/cube/headDecorations/Ears2", false);
initMeshes(eyes01, bodyPartsParent.children[1].children[1].children[0], false);
initBodyPartsMaterial(eyes01, bodyPartsParent.children[1].children[1].children[0],
"textures/cube/eyes/Eyes", false);
console.log(bodyPartsParent.children[1].children[1].children[0].name);
initMeshes(eyes02, bodyPartsParent.children[1].children[0].children[0], false);
initBodyPartsMaterial(eyes02, bodyPartsParent.children[1].children[0].children[0],
"textures/cube/eyes/Eyes2", false);
console.log(bodyPartsParent.children[1].children[0].children[0].name);
hideMeshes(mesh);
generateParts(bodies, tails, headDecorations01, headDecorations02, eyes01, eyes02);
const animations = gltf.animations;
if (animations && animations.length) {
mixer = new THREE.AnimationMixer(mesh);
const action = [];
action[0] = mixer.clipAction(animations[0]);
action[1] = mixer.clipAction(animations[1]);
action[2] = mixer.clipAction(animations[2]);
action[3] = mixer.clipAction(animations[3]);
action[0].setEffectiveWeight(1);
action[1].setEffectiveWeight(1);
action[2].setEffectiveWeight(1);
action[3].setEffectiveWeight(1);
action[0].enabled = true;
action[1].enabled = true;
action[2].enabled = true;
action[3].enabled = true;
action[generateRandomNumber(animations.length)].play();
}
scene.add(mesh);
},
// called while loading is progressing
function (xhr) {
console.log((xhr.loaded / xhr.total * 100) + '% loaded');
},
// called when loading has errors
function (error) {
console.log(error);
}
);
}