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.
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.
scene.addChild(tree,'Tree');
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
11 comments so far
Leave a reply
Thanks for posting. I’m currently researching viable workflows from 3d model to papervision and this simple concrete example has helped a great deal.
I realize this is probably V 1.5. I’m having real pains getting a collada file to show up. I’m using the “duck” model from collada OWL. Have you tested this method in V2.0?
heb, have not tested that method specifically, can you give us a bit more detail?
I didn’t have any luck with “new Collada” in 2.0. I did get a successful load using the DAE object as explained here; http://modern-carpentry.com/talk/?p=30
I also stumbled across some new parsers in 2.0. There is one for Sketchup, which is currently giving me errors, but hopefully they will have it sorted out soon.
I’m trying to figure out surfaces and lighting now;) Thanks for the help.
Thanks a lot!!
Finally a good and short tutorial how to SIMPLY import 3D Models into Papervision 3D.
[...] cool example with source of a very realistic tree, using PV3D and Collada. No Comments Leave a [...]
Thanks for the nice, clean example.
In the interests of making your excellent example marginally better, you could remove the declarations for xdoc and tree on lines 28 and 29.
Thanks again.
I haven’t tried this yet, but it looks good.
Thanks!
Finally! A simple yet working tutorial! I have been spending lots of time searching around on this one simple thing on how to import collada files. Thank you very much!!
Your links are broken.
Rob, sorry about the links, we are in the process of migrating this blog.