« Return to Thread: [GreatWhite] DAE and MD2 now implement basic animation

Re: [GreatWhite] DAE and MD2 now implement basic animation

by Tyler Egeto :: Rate this Message:

Reply to Author | View in Thread

Hey Tim, this is great!

We are experimenting with it in the office and have noticed what appears to be a bug some where, but only occasionally. It looks like this:

START READING #13 ANIMATIONS...
...
animations #13 of 13
Error: (3)(3)
        at org.papervision3d.objects.parsers::DAE/buildAnimationChannel()

Its being triggered in the arrayMember switch statement (line 363) when it doesn't match one of the cases. We are not sure of the cause, because sometimes it loads and plays just fine. It might be something in our 3ds file perhaps,

anyways I just wanted to pass that on to you.

Thanks for the greta stuff!

-Tyler

Tim Knip-2 wrote:
Hi all,

Just added simple animation for DAE and MD2.
Both now implement the IAnimatable interface, which has 2 methods:
1] IAnimatable.play( clip : String = null )  : void; => Starts the
animation (@param clip is mostly used by MD2: md2.play( "run" ),
md2.play( "wave" ), etc.
2] IAnimatable.stop() : void;  => stops the animation

Changes:
1] DAE and MD2 have a new @param 'autoPlay' in their constructors. If
true the animation will start automatically.
2] When file is completely parsed FileLoadEvent.LOAD_COMPLETE is
dispatched (was Event.COMPLETE)
     => NOTE: animation-data still needs to get parsed at this point,
see below...
3] When all animation-data is parsed from the file then
FileLoadEvent.ANIMATIONS_COMPLETE is dispatched.

Usage:
var dae : DAE = new DAE( false );  // lets show when 'autoPlay' is false...
dae.addEventListener( FileLoadEvent.LOAD_COMPLETE, onLoadComplete );
dae.addEventListener( FileLoadEvent.ANIMATIONS_COMPLETE, onAnimationsComplete );
dae.load( "myfile.dae" );
scene.addChild( dae );

private function onAnimationsComplete( event:FileLoadEvent ) : void
{
    if ( event.target is DAE )
    {
        var dae : DAE = event.target as DAE;
        dae.play();
    }
    else if ( event.target is MD2 )
    {
         var md2 : MD2 is event.target as MD2;

         md2.play();
         // or :
         // md2.play( "wave" );  // 'wave' is one of the clips defined
in the md2.
    }
}

private function onLoadComplete( event:FileLoadEvent ) : void
{
   // not used
}

Have fun!
Tim

_______________________________________________
Papervision3D mailing list
Papervision3D@osflash.org
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
Tyler Egeto
TylerEgeto.com
Have question? Email me at tyleregeto[at]gmail[dot]com

 « Return to Thread: [GreatWhite] DAE and MD2 now implement basic animation