Name of the current animation

Software: Away3D 4.x

Alex Bogartz, Sr. Member
Posted: 06 October 2011 05:29 PM   Total Posts: 216

Hi guys,

The animation controller does not seem to be able to return the name of the current animation.

I created a new function:

/**
   * returns the name of the currently playing animation
   */
  
public function get currentAnimation():String {
   
for (var prop in _clips{    
    
if (_clips[prop] == clip{
     
return prop;
    
}
   }
   
return null;    
  

I just needed to make “clip” a class level var instead of a local var in SmoothSkeletonAnimator.as

Now, if you want to check if you are already playing an animation like “jump” you can just check for that property

if (character.onGround() && _animationController.currentAnimation=="jump"{
      _animationController
.play("idle"0.2);
     
_animationController.timeScale TIME_SCALE;
     
    

Seems to work well.  Do you guys want to add this?

   

Richard Olsson, Administrator
Posted: 07 October 2011 02:50 AM   Total Posts: 1192   [ # 1 ]

Thank you for your initiative, but we are going to be doing a bit of a refactor of the animation system before 4.0 goes final, so although the actual feature request is great, we won’t be able to use your code. If you want to make sure we don’t forget about this feature, please file an issue report at GitHub. smile

   

Alex Bogartz, Sr. Member
Posted: 07 October 2011 01:58 PM   Total Posts: 216   [ # 2 ]

Will do.  What I’m finding I’m missing the most are what I call “convenience functions”.  Functions that return useful info about where you are, what’s happening, and when it’s done.  I’m sure a lot of it exists and I’m just ignorant of the functions but for my unsolicited two cents:

More functions like these, please! 

grin

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X