Jump to content

Restart a finishing animation


AB95
 Share

Recommended Posts

Hi everyone,

there might be a way of doing this but I must be missing something...

I have a scene which consists of different meshes having different animations, all of the animation only run once.

Basically, I would like to be able to "reload" the scene without actually reloading it, which I try to reset all the meshes' animations by pausing all unfinished meshes' animatable, set their animation's frame back to zero, and restart each of the animatable again.

This method work when all of the animatables in scene have not reached their last frame. It won't work on those animatable who had reached its last frame, which their frame will be set to zero, but not able to be restarted.

A simplified scene that showing my approach, as you will see the restart button doesn't work when the animation has reached its last frame.

http://www.babylonjs-playground.com/#OQENJ

Any help would be appreciated, thank you!

Link to comment
Share on other sites

Hi @aWeirdo and @JohnK

Thanks for both of your quick response! 

JohnK method works for me -- only if my issue is within the playground scene, the thing is, sry for the simplified scene, I realise I should have pointed out some part that make me resist in using scene.beginAnimation, the reason is that I had another animation within the callback of the first animatable:

http://www.babylonjs-playground.com/#OQENJ#5

which using scene.beginAnimationI() will cause the animatable within the first animatable's callback being called without the first animatable completes its animation (you should be able to observe the second animatable start before the first animatable finish, by pressing the restart button before the box finish its animation).

 I try to I explain my problem as clear as possible, thanks for the help!

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...