Rewind anim state question

Dear forum,

I have built out a version to demonstrate the issue PlayCanvas | HTML5 Game Engine you can see that when the model pops up the first time the cab is in the correct spot and starts driving around the bagel. Code then disables the entity and then enables it again, the build animation plays but the cab starts from the incorrect position then snaps back to the start of it’s loop. How can I reset the position of the cab?

The project is not public unfortunately to look at

1 Like

Thanks for the heads up, the otehr projects have been private, seems to be my default now. Here you go, PlayCanvas 3D HTML5 Game Engine

I had a look at this, what’s happening is that each animation is only animating a subset of nodes.

ie, the first animation that is making the globe move upwards is not animating the taxi.

That’s why the taxi position doesn’t ‘reset’ when you play that animation again. The animation doesn’t affect that taxi node so it stays where it is.

@Elliott may be working on something like this (a reference frame) that make this work.

However, in the meantime the way I got around this for this particular example was to set the currentTime to 0 in the update and then set the transition in the postUpdate call. (Or use a setTimeOut to start the transition in the next frame as seen here:

The need to set the transition in the postUpdate is because there needs to be an update call to the animation to process the the setting the time to 0 and set the position of the nodes back to the start of the animation.

(This may get addressed in this PR:

The alternative is to change the animation so that there is a frame where it sets all the nodes to where they need to be.