Tag Archive for 'Collada'

Papervision Collada – Spongebob SquarePants

Spongebob SquarePants

View Collada Spongebob in Papervision

I had some time on my hands this weekend and decided to mess around with loading Collada models with Papervision. I snagged a few models from Google Sketchup and went to town. Also tried to work in some OOP instead of just having one huge papervision file. I really need to clean up the source but rest assured the full source will be posted soon.

Basic lesson is that you can load a Collada file with just actionscript (packaged as a zip or just the dae file)

Actionscript:
  1. //Load zipped dae file
  2. protected function loadKMZ():void
  3. {
  4.     kmz = new KMZ();
  5.     kmz.load("model/spongebob_squarepants.zip");
  6.     kmz.addEventListener(FileLoadEvent.LOAD_ERROR, onKmzError);
  7.     kmz.addEventListener(FileLoadEvent.LOAD_COMPLETE, onKmzLoaded);
  8.    
  9.     //Scale if needed
  10.     kmz.scale = 20;
  11.     container.addChild(kmz);
  12. }
  13.  
  14. //load the dae file
  15. protected function loadDAE():void
  16. {
  17.     dae = new DAE();
  18.     dae.load("model/spongebob_squarepants.dae");
  19.     dae.addEventListener(FileLoadEvent.LOAD_ERROR, onDaeError);
  20.     dae.addEventListener(FileLoadEvent.LOAD_COMPLETE, onDaeLoaded);
  21.     container.addChild(dae);
  22. }


Follow papervision2 on Twitter

RSS Feed