Few Questions About Vertex Animation Playback: Looping, Detecting Playback Completion, Animation Length, Initial State

Software: Away3D 4.x

PixelPerfect, Newbie
Posted: 25 June 2014 12:07 PM   Total Posts: 13

I have a few questions about vertex animation.
I’ve created .awd file with vertex animation using c4d exporter, and it is successfully loaded and playing animation, but:

1. How to detect end of the animation? both while loop is on and wile it’s off? (iv’e found PLAYBACK_COMPLETE event in documentation, but don’t know how to listen for it)

2. How to get animation length?

3. After loading the model it stopped not on first frame, is it problem with away or with exporter?

4. How to toggle loop flag on the fly after model loading?

.awd and .c4d files attached, i can provide as3 class as well if it may help to answer my questions.

Could you please help me with this minor but essential questions.

 

File Attachments
box.awd  (File Size: 250KB - Downloads: 185)
BoxCrashAnimation-2.c4d  (File Size: 656KB - Downloads: 0)
   

PixelPerfect, Newbie
Posted: 26 June 2014 03:01 PM   Total Posts: 13   [ # 1 ]

After digging source code I’ve found answers
hope it’ll help someone :~)

var va:VertexAnimator VertexAnimator(_mesh.animator );
var 
vcn:VertexClipNode VertexClipNodeva.animationSet.getAnimation("AnimationName") );

vcn.looping true// this way you can toggle looping
trace(vcn.frames.length); // get animation length

vcn.addEventListener(AnimationStateEvent.PLAYBACK_COMPLETE, function():void{trace('Animation complete');}); // this event will fire only when looping==false

va.addEventListener("cycle_complete", function():void{trace('Cycle complete');}); // this event will fire only when looping==true 
   

PixelPerfect, Newbie
Posted: 26 June 2014 03:11 PM   Total Posts: 13   [ # 2 ]

it is a bit wired that “loop complete” and “playback complete” events are dispatched by different objects.

I think that it is a good idea to add few public methods to VertexAnimator class like: 
va.setAnimationLooping(“animationname”, true);
va.getAnimationLooping(“animationname”);
va.getAnimationLength(“animationname”);

and to forward “playback complete” event to VertexAnimator

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X