[SOLVED] Animation doesn't play

Hi my fellow game devs,
i have a problem with my animations. they seem to work in code (alteast animation.currentTime is correctly updated) but my model stays in T-Pose.

var GoalKeeperAnimationController = pc.createScript('goalKeeperAnimationController');

// initialize code called once per entity
GoalKeeperAnimationController.prototype.initialize = function() {
    this.model = this.entity.findByName("Model").model;
    this.setState("keep");
};

// update code called every frame
GoalKeeperAnimationController.prototype.update = function(dt) {
    if(this.model.entity.animation.currentTime >= this.model.entity.animation.duration){
        this.model.entity.animation.currentTime = 0;
        this.setState("keep");
    }
};

GoalKeeperAnimationController.prototype.setState = function(state){
    this.state = animationStates[state];
    this.model.entity.animation.play(this.state.animation, 0.2);
};
animationStates = {
    keep:{
        animation: "WGkeepBall.json"
    },
    catch1:{
        animation: "WGsaveBall01.json"
    },
    catch2:{
        animation: "WGsaveBall02.json"
    }
};

did i miss something or are there any engine settings that prevent animations from playing ?
thx, for reading this :slight_smile:

Looks kind of OK to me. But, to be honest, it’s very difficult to tell just by visual inspection. I strongly recommend you post a link to a scene that demonstrates a problem you’re having. That makes is far easier for others to help you (and generally saves a lot of time).

i could not show it in public because it’s a company project.
the problem was a root motion plugin in my assets.

OK, glad you solved it. :smile:

BTW, you don’t need to share the original scene - you can normally construct a new, cut down project that reproduces an issue you’re having. It’s always a big help to track down a problem.