Animations with Draco Loader three js


I am using Draco with my model and created an animation in blender.

But i cannot find the animations in the animations array of the 3d element.

When i use “const clip = THREE.AnimationClip.findByName(clips, “Action”);”

I can find it in the console, but it doesn’t play at all.

here is my code :

let mixer;
let clock = new THREE.Clock();
dracoLoader.setDecoderConfig({ type: "js" });

  function (gltf) {
    mixer = new THREE.AnimationMixer(gltf.scene);
    const clips = gltf.animations;
    const clip = THREE.AnimationClip.findByName(clips, "Action");
    const action = mixer.clipAction(clip);;

    gltf.scene.children[1] = videoTexture;
    gltf.scene.children[1] = false;
    gltf.scene.children[1] = Math.PI;
    gltf.scene.children[1] = THREE.RepeatWrapping;
    gltf.scene.children[1] = THREE.RepeatWrapping;
    gltf.scene.children[1].material.lightMapIntensity = 1.3;

    function animate() {
      if (mixer !== undefined ) mixer.update(clock.getDelta());

I would recommend you start by checking that the export itself is correct. Test the model in an online viewer and see if the animation plays back.

it works perfectly on both of them

Here is the console.log(action)

It looks like you are calling on every frame in the animation loop, but not rendering the scene. You only need to call once, but should render the scene on every frame. The webgl / animation / keyframes example might be helpful.

Thank you very much, I made lots of changes and made some organizing in my code,

I don’t know what exactly I did but it works now. I hope I knew what I did to write it here for someone else with the same problem.