Navigation


RSS : Articles / Comments


Animated DAE Files (ASCollada)

7:17 PM, Posted by Jim Foley, 23 Comments

So I recently decided to try picking up how to import and play animated DAE models. To be honest, when I first started I was ubber confused cuz, well, there are no sample files, blog posts or clear documentation on how it works.

When I first started I thought that the ASCollada branch was the answer to all my problems (yes and no). I kept thinking that there was some special ASCollada file parser that I had to use or something (wrong). To import in animated DAE files all you have to do is declare a new DAE() object and then load in your .dae file that has been previously animated in a 3D app. The AS3 portion of it is pretty self explanitory (see source files).

Other questions I had when I was trying to make animated DAE files were, how do I set up my animations within other 3D programs? What animations are supported? What software is best for exporting? Well, I was able to answer some of these but not all.

1. How do I set up my animations? Easy, don't do anything special, just create a linear animation on your 3D app's timeline and export.

2. What animations are supported? I did 4 different tests. (1) I tried just plain old transform animations (ie. move, rotate, scale) and when I ran the exported file from Papervision it worked just fine. (2) Modifier animations, didn't work, it errored out. Not sure if its just not supported or if I did something wrong. I would guess that I did something wrong because when I applied the modifiers i created a stack of 3 or 4 different modifiers (no wonder it might error out, haha). (3) Morpher animation, this errored out as well. Again, not sure if its not supported or if I did something wrong. I created a Morpher for my object and used another object that had (again) a ton of modifiers applied. So, for test 2 and 3 I'll have to give them another try but use simplified animations. (4) Bones! Bones was successful! Weeee, thats good cuz its the one I was most interested in and Bones is what my attached example is based on.

3. What software to use? I'm a Swift 3D and 3ds max guru. I love these programs. So, obviously Swift 3D is great and wonderful but it is very limiting when it comes to this level of animation and on top of that Swift 3D doesn't export animation data to the collada file, not yet anyways. So, in the end I went with 3ds max. Unfortunately I don't own 3ds max so I downloaded the trial of 3ds max 2009, that didn't work and I got nothing but headaches from everything I attempted. So, I called up my old buddies from Electric Rain, they have various versions of 3ds max that I could try exporting Collada files from. NOTE, 3ds max 2009 has its own collada file export but it doesn't work with Papervision for some reason. If you step back and use an older version you will need the Feeling Software - ColladaMax plug-in (its free). I also tried using 3ds max 8 but that didn't work either, eventually I tried 3ds max 9 with the ColladaMax plug-in, and, SUCCESS! All off these various applications seemed to be the most happy in this setup (3ds max 9, ColladaMax Plug-in and Papervision 3D).

Once I saw (at least) a couple of my test animations working, I was satisfied!
See my quick and dirty bones test animation below (don't pick on me, I didn't do any crazy cool animation or anything... just something to get the job done).

So if you've been dying to figure this stuff out, I hope this post helps! I hope to do various exercises on this subject and become more fluent with how it all works. I'll be sure to report back with any additional finds I may come across. If you have prized info on this subject please post links in a comment below.

Example: click here
Flex Source: click here
Flash Source: click here

23 Comments

Eric @ November 5, 2008 1:57 PM

I recently went through this same process. Like you I was very happy to see the bones working in PV. However, that was where I reached a dead end. I could only stop and play the animation. I could find no reference to animation properties like "current frame" or a way to play from one frame to another. It seems that it will only just loop over and over. Have you had any luck with this?

Jim Foley @ November 5, 2008 3:30 PM

I wanna say that the funcationality for this does exist. I did see a thread (written by Tim Knip himself) where there were methods such as...

dae.controller.gotoAndPlay(3);
dae.controller.gotoAndStop(1);
dae.controller.stop();
dae.controller.play();

But the thread was written back when ASCollada was not part of Great White. I checked to see if it still existed but (with a quick look) it didn't appear to be instantiated anymore. I'll prolly go sifting through the DAE class to see if there are clues to this. Please let me know if you have additional news on this.

psilos @ November 6, 2008 8:45 AM

Flex source zip is not opening, can u please upload it again?

Thanks

Jim Foley @ November 6, 2008 12:02 PM

@psilos - reuploaded

Mikkel Levisen @ December 5, 2008 12:35 PM

First of all thanks for all of these absolutely fantastic tutorials!!!

now the question: I'm almost new at papervision and trying to load in an animated collade file like in you example. My problem is i cant get it to loop.. I've been looking around the net and cant find any tutorials that explain haw to do it.

I've looked at you source file and when i compile it, it doesn't loop like in the example..

pablobandin @ December 5, 2008 10:55 PM

I have made a class to control athe animation of a DAE object and i made a video tutorial.

this is the link

rawanda @ February 16, 2009 1:56 AM

hi , thanks for this great tutorial.
i installed 3dmax 9 and collade max plugin. made a simple animation using only transformation. and exported it. however it didn't import properly,
i got the following error, is there any special parameters to setup in the export dialog?

INFO: animations #3 of 4
INFO: animations #4 of 4
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at org.papervision3d.core.animation.channel::AbstractChannel3D/updateToTime()
at org.papervision3d.core.animation.channel::MatrixChannel3D/updateToTime()
at org.papervision3d.objects.parsers::DAE/org.papervision3d.objects.parsers:DAE::buildAnimationChannels()
at org.papervision3d.objects.parsers::DAE/org.papervision3d.objects.parsers:DAE::onParseAnimationsComplete()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at org.ascollada.io::DaeReader/::loadNextAnimation()
at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
at flash.utils::Timer/flash.utils:Timer::tick()

Jim Foley @ February 16, 2009 5:32 PM

Rawanda, I tried using 3ds max 9 collada export but it didn't work for me. What did work was 3ds max 8 with the Feeling Software export. Why 3ds max 9 doesn't work... I have no idea.

Anonymous @ February 17, 2009 6:27 AM

Thanks a lot for this sample !
(Sorry for my poor english).
I also followed pablobandin's tutorial ( http://pablobandin.wordpress.com/2008/12/06/control-dae-animation/ ), and i managed to import my own animated 3D model into paparvision, using 3DSMax 7 and FeelingSoft Collada plugin, but now i have a new problem: Did someone find a way to animate a DAE "boned" model directly in papervision? For example, is there a way to make your 3D imported character "point his finger" at the direction pointed by your mouse?
Here is a sample of what i mean:
http://dynamicnetcreations.com/experiments/DragonIK/
Unfortuantely, i didn't find any source code explaining how he did this...
Thanks in advance.
Ray

Jim Foley @ February 19, 2009 9:58 AM

I have seen samples of people importing bones. Don't really recall where though.

Bartek is actually working on a method to apply bones to your objects directly within Papervision. See this link: http://www.everydayflash.com/blog/index.php/2009/02/09/making-things-walk-in-flash-3d/

rawanda @ February 27, 2009 5:13 AM

hi again
i am now able to export the dae to pv3d. but it does not export the animation, even simple transformation don't export properly, however after importing your cylinder and exporting animation does work. what is the secret?

rawanda @ March 23, 2009 10:37 AM

Hi,
I'm having problems with displaying my collada model,
you can see it here:
http://www.tashiweb.com/deploy/
i built it in 3ds max 9 and exported using the feeling software colladaMax plugin
it is a simple model of a box made out of 4 thin bcoulinoxes.
and on the top and bottom there are 4 extruded triangles
i tried minimizing the segments of all shapes to the point that the material does not distort.
as you can see there i a strange effect where the triangles sometime show infront of the boxes, and at certain angles parts of the triangles disappear.
does anyone have a clue why that happens?
thanks,
uri

Anonymous @ April 13, 2009 12:07 PM

I'd like to ask if there is any way to load 3D object and animation separately.
Imagine situanion when I have one object and multiple optional animations. I don't want to load every single animation when I use only one of them.
Is it possible?

Eric @ June 4, 2009 10:59 AM

Does anyone know whats up with the update to PV? It seems that after change 911, which was a rework of the animation functionality, none of my animations will load with the DAE. When I updated my PV classes this week I lost all animations in any of my files using a dae. This sucks! I have a ton of changes due and everything worked last week.

Is there a way to import your animations separately if they fail to load on initial import?

Wessness @ July 28, 2009 10:08 PM

@ Eric

Yea it seems that now when using the DAE Class, you can no longer reference objects within the scene. I have tried everything. I ended up switching back to the Collada class and everything works fine now. The error it throws for me when using the DAE class is:

WARNING: Needs to be a do3d

This goes for when you try to reference ANY DisplayObject3D within the Collada when using the DAE Class.

I burned hours on this before I just decided to rework with the Collada class. Anyone else having this problem?

ZoiX @ September 4, 2009 5:09 PM
This post has been removed by the author.
ZoiX @ September 5, 2009 12:20 PM

Hi Jim!
I downloaded your animation and I was working on it to transform in Augmented Reality application, if you want Flex code and the marker I can send you via e-mail. xsdaniel [at] gmail [dot] com

Rodrigo. @ October 30, 2009 9:56 PM

Hi!

Can anyone give some help with the DAE files, am trying to import a simply animated DAE (scale trasnform over timeline), but something goes wrong, when i put the DAE files from this tutorials, the animation works, but mines doesnt =(, am working with 3Dmax9, anyone knows wich is the correct configuration or whatever?

saharyas @ November 10, 2009 12:28 AM

hi I downloaded flash sample file but when I run the source I have this error "1017: The definition of base class TriangleMaterial was not found." and "1020: Method marked override must override another method." what should I do?

Anonymous @ November 22, 2009 11:18 PM

THNX youre a crack

Sung @ December 7, 2009 7:37 AM

Thanks so much. It's great!!

imoet @ February 17, 2010 9:28 PM

thank you for sharing

Anonymous @ February 18, 2010 4:42 PM

You can also use Blender to export your models to collada.dae files. They work great with Papervision...