Jump to content

Way to retrieve frame when a baked animation has been stopped


paleRider
 Share

Recommended Posts

Hi everybody!

Under our "current" framework we're using animated meshes exported from blender to babylonjs.

This way, we find it would be very fair to know the frame where a playing (long) animation has been stopped (by means of scene.stopAnimation) in order to implement a "pause and reverse animation from that frame" behaviour,

I can´t find that functionality implemented anywhere. Is it possible to do?

Best regards.

Link to comment
Share on other sites

First of all, thank you for your time Raggar.

Well, as said, I have a long animation that is played to show a mesh "exploding" and the same animation played in reverse direction (using scene.beginAnimation reverse mode) to "assemble" the mesh.

All that is exported (flawlessly) in a scene from Blender, and I play the two animations (indeed is only one, as said, played in forward or backward direction) without problem.

But now I want to give the user the choice of not to wait until the end of the animation (explode or assemble) in order to launch the opposite one (assemble or explode). That is, I want to let him/her to stop the animation at any time of its playing and change the direction from that point. In order to accomplish this task I need to know where (current frame) has been stopped the animation, retrieving it when scene.stopAnimation returns.

I don´t know if I'm being clear enough with this explanation.

Best regards.

 

 

Link to comment
Share on other sites

Hi PaleRider... welcome to the forum.  I did not perfectly succeed... because I needed to retrieve animation currentFrame JUST BEFORE stopping animation.

If I stopped animation FIRST, the currentFrame was always 0.

http://www.babylonjs-playground.com/#7ZDKA0#5

Line 70 is where the currentFrame is put onto button text when animation is stopped.

I hope you didn't expect the currentFrame to be a whole integer.  :)  Instead, it is dragging-along a pile of floating sea weeds... after the decimal point.  heh.

Hope this helps.

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...