Papervision3D & Collada’s

So after tinkering some more with papervision, and doing alot of research dealing with importing collada’s, I couldn’t manage to find a working example almost anywhere online.

I finally managed to find a working (papervision3d-ready) model, and decided to setup a simple example of importing collada’s with good source.

View Live Demo

The first problem that many people experience and encounter that i’ve noticed in dealing with Collada’s is either the object reference error, or the ‘Implicit Cooercion of a Value’ error, both of which stem from an improperly exported Collada model.

One of the big tips I’ve noticed is not checking the “Triangulate all Faces” or the “Triangulate all objects” options in blender/3DS/C4D/whatever 3d modelling program you may be using.. Im quite certain that not doing this is what is causing alot of BLACK collada screens, when your papervision code may be 100% correct.

The code in and of itself to import a collada file is extremely easy, it looks something like this-

var tree:DisplayObject3D = new Collada("models/tree.dae",null,0.1,null);

Then, like all other papervision3d display objects, you just add it to your stage.


One other interesting way I noticed to interact with my object once its on the stage, and you want to reuse it later, is to use the getChildByName function, which is why my addChild appends the ‘Tree’ at the end; Giving it a name.

If you look at the tree demo’s source code, you will see on the bottom how i recall the object, and manipulate the rotation of it with the mouse.

Be sure to check out the full source code to the tree demo below.

The tree model was not created by me, it was downloaded from the Google Sketchup 3DWarehouse. There are lots of sample colladas, and files to mess around with there, it just may prove frustrating trying to find a model that is properly exported for papervision this way.

Tree Demo: Source Code
Tree Demo: Live Example

About Curious Minds
We are a web development firm in New York and Chicago, providing development resources and consulting for websites and mobile apps since 2004.