Reset model/skeleton when stopping/switching animation

Hi guys,

I’d like to stop the currently playing animation. When I do it via disabling the animation component this.entity.animation.enabled = false, the model graph is not reset to its original state, e.g model just ‘stops’ on the current animation frame and thus may be rotated/scaled/positioned depending on the animation played before. Same time, all the entity’s public properties (getRotation(), getPosition(), getLocalScale()) stay unchanged, but visually model does look rotated/scaled/moved.

Is there a way to reset the model graph (position/rotation/scale properties) when stopping entity animation?

1 Like

Hi @Igor,

I haven’t tried it myself, but I think setting the current time to 0, before or after stopping it will do the trick:

this.entity.animation.currentTime = 0;

https://developer.playcanvas.com/en/api/pc.AnimationComponent.html#currentTime

1 Like

@Leonidas thanks for the answer. Unfortunately, it doesn’t work.

2 Likes

Maybe then the API is missing some straightforward way of doing this.

Would you like to submit an issue about it in the engine repo?

Sure, gonna submit it soon.

2 Likes

Any update to this? having a similar problem

You will need to add an ‘pose’ anim and state to change to when you want to reset the model