How to stop() all actions of an object?

Hi, I want do stop() all actions of an object?

startAnimation(objectName) {
    // mixer is set to complete scene  this.mixer = new THREE.AnimationMixer(gltf.scene); 
    this.mixer._actions.forEach(action => {
        ???
    });

Thanks…

Deepseek is better than ChatGPT :slight_smile:

this.mixer._actions.forEach((action) => {
    if (action.getClip().name.includes(objectName)) {
        action.stop();
    }
});
action["soldier_attack_1"]=mesh["soldier_attack_1"].animations[0];
action["soldier_attack_1"]=mixer["soldier_attack_1"].clipAction(action["soldier_attack_1"]);
action["soldier_attack_1"].play();
mixers.push(mixer["soldier_attack_1"]);

Stop: action["soldier_attack_1"].stop();

Thxs Chaser_Code!
But currently I want to keep things as simple as possible, no managing of actions and mixer objects/arrays. I only changed the iteration direction because stopping an action influences the order in the _action array.

for (let i = this.mixer._actions.length - 1; i >= 0; i--) {
...
}
1 Like

lol… I guess both of them missed the “.stopAllAction()” method on the animationMixer.

read the docs folks! ( or at least tell your LLMs to read the docs! )

3 Likes

I tried stopAllAction() first but it stops all actions from the MIXER not an object?

1 Like

Fair enough. Then I would just give the object itself a list of its actions, iterating the _actions of the mixer and checking by name sounds brittle to me. But whatever works i guess.