activeStateProgress does not return 1 at the end when speed is greater than 1

Hi all,
I’ve noticed that AnimComponent’s activeStateProgress does not return 1 at the end when the speed is greater than 1.

I have an animation with a duration of 4.5 secs when the animation speed is 1 and I run activeStateProgress regularly and at the end, I get the result 1. But when I update the animation’s speed to for example 3, I get 0.26 at the end.

Is this a bug?

calling @Elliott

I think the engine’s code should be updated like this?

_getActiveStateProgressForTime;

const activeClip = this._animEvaluator.findClip(this.activeStateAnimations[0].name);
if (activeClip) {
    const speed = this.activeStateAnimations[0].speed;
    return (time * speed) / activeClip.track.duration;
}

@mvaligursky if it is right, I can create a PR

I’ve created a sample project here: PlayCanvas | HTML5 Game Engine
The branch name is: activeStateProgressIssuea

When you keep pressing key P, at the end of the animation you will see that activeStateProgress value is 0.5 , instead of 1.

1 Like

Please note only project members are be able to see branches.

Thanks for the info, I merged to master

1 Like

I created issue on GitHub so others who are interested in can follow up here: activeStateProgress does not return 1 at the end when speed is greater than 1 · Issue #4904 · playcanvas/engine · GitHub

It seems that @yaustar created one here: activeStateProgress does not return 1 at the end when speed is greater than 1 · Issue #4903 · playcanvas/engine · GitHub