Jump to content

[Solved] Is there a way to check which animation is playing on an object?


jpdev
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

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