Papervision3D tutorial updated: embedded Collada

Posted by Dennis on Mar 30, 2007 in 3D, ActionScript, Flash, Flex3 comments

Papervision3D has had a little revision which affected my tutorial. Some people had problems loading the .dae file because they used a different directory structure. I thought it would be a good idea if Papervision3D supported embedded Collada files. Turned out I wasn’t the only one, so this feature is now supported in Papervision3D’s latest version. Here’s what’s changed in the source code:

I added the following metatag in the class file:

[Embed(source="../assets/mycone.dae", mimeType="application/octet-stream")] private var MyCone:Class;

This embeds the .dae file and assigns it to a class. The mimeType attribute is needed because Flex doesn’t recognize the .dae extensions. Later on we need to cast this object to XML. The other changes are made in the init3D() method:

rootNode.addChildren( new Collada( XML(new MyCone()), new MaterialsList( myMaterials ) ) );

Here I make use of the new Collada class and pass it the embedded object (cast to XML) and the materials list. The rest of the code remains the same.

You could pass the URL to the Collada file instead of an embedded object, so it loads at the runtime:

rootNode.addChildren( new Collada( "../assets/mycone.dae", new MaterialsList( myMaterials ) ) );

See the updated tutorial here



Tags: , , , , ,


3 comments

» Comments RSS Feed
  1. Thanks a lot for your tutorials!!!
    Hope you will continue. I am interested in making a camera like in the Rhino file:
    http://www.noventaynueve.com/lab/rhino/

    What to do in 3ds? And what to do in Flash? Hopefully you know how to do it and want to make a tutorial on it. It is so nice being able to navigate with a camera in plan view - not just having a look around a Rhino…

  2. nice article

  3. This one is for FLEX SDK but what if I have Flash CS4 ?

    Any suggestions? But installing Flex :)

Leave a comment