Importing .GLTF animation into THREE, getting unknown error?

I have an animation created in Cinema 4D (baked and everything) and the animation plays perfectly fine in the GLTF viewer
https://gltf-viewer.donmccurdy.com/
and even in the GLTF preview extension is VSCode.
However when I try to load it using the THREE.GLTFLoader, I keep getting this error:

And I cannot find any solution to this online. Any help is appreciated! :slight_smile:

Can you please share the glTF asset in this thread?

Uploading: signatureAnimation.gltf…

Um, it seems the upload of your asset did not work. Can you try it again?

What version of threejs are you using? If it works in http://gltf-viewer.donmccurdy.com/ and you’re using an older version, it may be worth updating.

I recently upgraded to the latest one, which I believe is three@0.89.0.

I was able to locate what was throwing the error, which was
03%20AM
in the GLTFLoader.js
GLTFLoader.js (64.1 KB).

It looks like .clone(); just isn’t a recognized function in this instance?

https://mega.nz/#!sPwSVSzK!uJyXjZ5QN8MXMM2RYInS3MdEzjm4Twg5g3opvxtatx4

three@0.89.0

The latest version is three@0.106.2

1 Like

If I import this file in gltf-viewer, the file can be successfully loaded and the animation starts but I get an out-of-memory runtime error after a certain time. Consider to reduce the complexity of your geometry so it’s more suitable for an interactive 3D application. Right now, your file is 528 MB big. A bit too much I guess^^.

Great thanks, so I went ahead and reduced the size of the animation and upgraded to three@0.106.2. I am now running into this problem and have no idea what angle to tackle this from: the GLTF that I
am exporting (Cinema 4D settings) or the code itself.


It has to be:

this.mixer = new THREE.AnimationMixer(gltf.scene);

Ah, didn’t see that. Thanks!
Is there the option to change the MeshStandardMaterial to another material and/or import materials from the .gltf file as well?

You can change the materials after loading the glTF asset. For this, you traverse through the loaded scene and freely change to different materials. E.g.

gltf.scene.traverse( function( child ) {

    if ( child.isMesh ) child.material = otherMaterial; // change the material for all meshes in the scene

} );

I found that by doing that, it stopped the animation from playing altogether

You’ll need to make sure that the new material has the right settings from the old material. For example:

newMaterial.skinning = oldMaterial.skinning;
newMaterial.morphTargets = oldMaterial.morphTargets;
newMaterial.morphNormals = oldMaterial.morphNormals;
1 Like