paleRider Posted July 11, 2017 Share Posted July 11, 2017 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. Quote Link to comment Share on other sites More sharing options...
Raggar Posted July 11, 2017 Share Posted July 11, 2017 Have you seen this example: http://www.babylonjs-playground.com/#7ZDKA0#4? The animations, baked or not, must be stored somewhere. And the current frame of the animation playing likewise. Quote Link to comment Share on other sites More sharing options...
paleRider Posted July 11, 2017 Author Share Posted July 11, 2017 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. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted July 11, 2017 Share Posted July 11, 2017 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. Quote Link to comment Share on other sites More sharing options...
paleRider Posted July 11, 2017 Author Share Posted July 11, 2017 Thank you for your time Wingnut. I'll do as you say, as it doesn´t break my code. I'll round the floating point frame also. Best regards. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.