For anyone interested in learning how to load .dae (collada) files into Papervision3D 2.0, this is your lucky day!
A collada file is an open source version of your regular 3d file, whether it be created in 3dStudio Max, Maya, Blender, SketchUp, etc. It is essentially an XML file that describes all the assets, lighting, and textures of a 3 dimensional object.
Papervision3D 2.0 comes packaged with ASCollada, which was made by Tim Knip, and is quite a feat. Tim’s classes go through a collada file, parse all the information, and make it happen in Papervision. If you ever want to feel like a noob, just have a look inside the ASCollada/core directory and the files contained within, they’re quite extensive.
Anyways, once you have a collada file which ends with a .dae extension, you can import it into papervision with a simple command:
var daeFile = new DAE(”yourFile.dae”);
And that’s pretty much it in terms of getting the .dae file into flash!
But wait, there’s more!
A few things should be noted about doing all of this. Because of the time it takes for ASCollada to parse a .dae file, the script will often run more than the default 15 seconds and throw an error.
You can get around this by changing your script time limit in File/Publish Settings, and put it up to 30 or even 60 seconds. This will give Flash enough time to parse the XML before it throws an error.
Some other issues:
3d editors let you animate 3d scenes and objects, and, lo and behold, ASCollada supports these animations! Trouble is, Papervision3D 2.0 is still in Alpha testing, and the animations will sometimes throw an error if they are not in the proper format.
If you have an animation that isn’t working, please let Tim know about it. He’s busy trying to figure out everything right now, and the more files he has to test the better he can build ASCollada.
If you do not have access to a 3d application (kind of like me) you can do some googling to find some sample collada files. I got a few at Collada.org. These ones were kind of old, and perhaps that was the reason why their animations were not working.
If you do use any of these, or any other model that you find, make sure the texture images are NOT in the .targa format (which isn’t supported in flash). Also, make sure to go through the collada file, find where it is referencing the texture, and verify that the path to the image is correct.
And with that, its time relax and stop obsessing over Papervision3d 2.0 for the weekend.