jpdev Posted February 17, 2017 Share Posted February 17, 2017 Hi guys, I am looking for a way to find out which animation is "really" running on an object. I start my animations this way: this.mesh.skeleton.beginAnimation(name, true, 1.0); "name" is a string that is the animation name in blender. It get's translated to a range (begin frame and end frame) and that is played. I track which animation I set last to know what the animation of the object should currently be - but sometimes this doesn't match what is actually displayed. I am not sure what goes wrong - but I would like to be able to fix it. (For example, sometimes the death animation doesn't play on players - they just look frozen until respawn, and I would like to be able to correct this.) I am currently unable to check if what animation I think is playing is really currently playing. What I am looking for is a way to do this: this.mesh.skeleton.getAnimationName() or this.mesh.skeleton.getAnimationNames() - but not by tracking what animation name was last set (that's what I am doing now) but by really checking if the correct range is playing. I will gladly implement those myself, but I have looked the data in the skeleton, and I can't tell where I can find the currently playing animation range or the current frame. Any pointers into the right direction are appreciated. Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted February 17, 2017 Share Posted February 17, 2017 skeleton._animatables[0].animations[0].currentFrame (The first animation of the first bone. There can be multiple animations.) jpdev 1 Quote Link to comment Share on other sites More sharing options...
jpdev Posted February 17, 2017 Author Share Posted February 17, 2017 Hi, Thank you for the answer. I have found another thing that (not accessing "_" privates) seems to give me the required information: The beginAnimation returns an animateable object that contains the from and to frames and a flag if the animation is playing (animationStarted is the name of the flag). Right now that is how I try to solve my issue, if it does not work out I will look into the current frame! Edit: While I seem to have solved my problem by checking the animateable that is returned, your currentFrame is the perfect answer to the initial question. Thanks again @BitOfGold. Solved. 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.