JohnM Posted May 15, 2018 Share Posted May 15, 2018 Hi, I was wondering, is it possible / could it be possible to create multiple animations for a single mesh but have them as separate animatables so you can pause and play etc each individual animation applied to that mesh? ive tried to create a new BABYLON.Animatable each time i create an animation but then the _runtimeAnimation is empty and .pause() .play() doesnt work. any help is much appreciate and if anything else needs explaining just let me know! many thanks, John Quote Link to comment Share on other sites More sharing options...
SinhNQ Posted May 15, 2018 Share Posted May 15, 2018 Hi, Yes! You can use scene.beginAnimation() function with target is mesh.skeleton, it will return an animatable instance. Quote Link to comment Share on other sites More sharing options...
JohnM Posted May 16, 2018 Author Share Posted May 16, 2018 Hi, thanks for your answer! I just wanted to clarify that all my animated objects are only meshes with no bones / rigging / skeletons. would this still work for my meshes? I would check it myself but I wont be able to work on it till tomorrow. Many thanks! Quote Link to comment Share on other sites More sharing options...
JohnM Posted May 17, 2018 Author Share Posted May 17, 2018 So i tried this - Quote You can use scene.beginAnimation() function with target is mesh.skeleton and it didnt work, im guessing because obviously I have no skeletons attached to my meshes, and unless they're characters, i prob never will. has anyone got any other suggestions? being able to control each individual animation would be a great help to me many thanks Quote Link to comment Share on other sites More sharing options...
JohnM Posted May 17, 2018 Author Share Posted May 17, 2018 I have also tried this - https://doc.babylonjs.com/how_to/group#how-to-group-animations but it doesnt seem to give the desired effect either. however i feel like it should, I feel like i should be able to apply a single animation to a group, how ever at the moment when i do this it says - SCRIPT445: Object doesn't support this action and points to this - var startAnim = new BABYLON.AnimationGroup("spherePosY"); startAnim.addTargetedAnimation(newAnimation, myObject); startAnim.pause(); Quote Link to comment Share on other sites More sharing options...
SinhNQ Posted May 17, 2018 Share Posted May 17, 2018 Hi, I think this is what you need https://doc.babylonjs.com/babylon101/animations ? Quote Link to comment Share on other sites More sharing options...
JohnM Posted May 17, 2018 Author Share Posted May 17, 2018 Hi, Perhaps i am not explaining myself clearly, I am bad for doing that haha. I have animations that I have created using this method. however when i then create a SECOND animation using this method. it obviously gets applied to that mesh also which is good. but what is bad (for me) is that the second animation ALSO gets applied to the SAME scene.Animatable. so when i do - anim.pause(); it would then pause BOTH animations, where as i want to be able to control each animation individually. i hope this makes more sense? many thanks. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 17, 2018 Share Posted May 17, 2018 To better help, the best would be to provide a repro in the Playground Quote Link to comment Share on other sites More sharing options...
JohnK Posted May 18, 2018 Share Posted May 18, 2018 Hi @JohnM and welcome from me. Is this the type of thing you are after? http://www.babylonjs-playground.com/#9WUJN#47 JohnM 1 Quote Link to comment Share on other sites More sharing options...
JohnM Posted May 21, 2018 Author Share Posted May 21, 2018 Hi guys, sorry for the late reply. regards to the repro, its difficult for me to make the time for a repro as this is a professional project and if bugs pop up for me whilst making the repro thats time taken away from something else, but yea i definitely understand it would help. JohnK - Yes thats exactly what I want!! how come your two animations have two separate animatables? mine always gets combined into one when two animations are applied to the same mesh. EDIT - I suppose a better question would be, can anyone explain or link me to the docs for beginDirectAnimation as i am assuming this is what is sorting my issue, but this, this and this is all i can find about it online. Many thanks. Quote Link to comment Share on other sites More sharing options...
JohnK Posted May 21, 2018 Share Posted May 21, 2018 2 hours ago, JohnM said: link me to the docs for beginDirectAnimation Just in the API http://doc.babylonjs.com/api/classes/babylon.scene#begindirectanimation Quote Link to comment Share on other sites More sharing options...
JohnM Posted May 21, 2018 Author Share Posted May 21, 2018 Yea, it just doesnt give any reason why it would create a new animatable vs stacking them like scene.beginAnimation does. oh well, it works. all that matters! thanks a lot 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.