A seek function for the SmoothSkeletonAnimator?

Software: Away3D 4.x

Alex Bogartz, Sr. Member
Posted: 13 December 2011 06:37 PM   Total Posts: 216

I’m not sure if this is already in place, but is there a way to scrub an animation in code by jumping a SmoothSkeletonAnimator to a certain time in its range?

I’d like to be able to say

_animationController.seek(.5

And have it jump to half way through the animation and play from there.  Is this possible?  Do I have to roll my own code on this?

Thanks in advance.

   

Alex Bogartz, Sr. Member
Posted: 13 December 2011 10:05 PM   Total Posts: 216   [ # 1 ]

So, I may be on my own on this one, but hopefully someone can chime in and tell me if I’m way off.

In SmoothSkeletonAnimator.as, I’ve added a single function.

public function seek(percentage:Number .5):void {
   
if (_lerpNode{
    
var timeToSeek:Number _lerpNode.duration percentage
    
warpTime(timeToSeek);
   
}
  } 

Ok, what this is attempting to do, is get the duration of the current animation and multiply it times the seek number.  So if the duration is 3000ms, it will return 1500.

So then I created a new public function in AnimatorBase.as.

protected function warpTime(timeOffset:Number):void {
   _time 
int(getTimer()-timeOffset);
  

This is supposed to offset the _time property so that it thinks it’s halfway through the animation and if I keep calling this function, it should appear to freeze on the half way point.  Only it’s not working.  Instead it seems to be trying to catch up for time lost (as if it’s correcting for a loss in frame rate).  This makes sense, except I don’t know where this is being handled.  Any ideas?  I feel like a seek/scrub function would be extremely useful.

   

Alex Bogartz, Sr. Member
Posted: 17 December 2011 07:21 PM   Total Posts: 216   [ # 2 ]

Just bumping one last time in case anyone has some clues on this.  Is this doable?  On the roadmap?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X