Question about animations

Hi everyone!!!

Is there a way to know which animation a character is running and, if so, it’s name? It’s for control issues…

Thank you! :slight_smile:

i can find that by the code as below.

    //refer the model attached
    this.model = this.entity.findByName("modelDataName");
    if(!this.model){
        //warn
        console.warn("Player: no player model data");
    }
    else{
        // echo the animation runnning
        console.log(this.model.animation.currAnim);
    }
1 Like

Just what I needed!!! Thank you so much @ogawa!

To reference current model of an entity, there is other way:
this.entity.model.model.
Difference is that it is a direct reference, instead of searching for child nodes, which in fact could find some other child node of such name you are searching. Which of course would be not desired in this scenario.

Thank you max!

Another question, is there a way to directly know if the animation is running, instead of using ‘currentTime’ and ‘duration’?

Noticed that it is not documented field.
We will be reworking animation component system and animation in the future, as it is too primitive already.

There is playing field on animation component.

2 Likes

Awesome, checking it out! Thanks!