Using Papervision Object Parsers
DAE Parser
What is a DAE file?
Yes, I know I just explained that Collada uses DAE. Well the DAE parser also loads Collada files. Just a different version (v. 1.4.1). These are good files to use if you would like to import assets that include animations.
DAE Parsing Example
-
package {
-
import flash.events.Event;
-
import org.papervision3d.lights.PointLight3D;
-
import org.papervision3d.materials.shadematerials.GouraudMaterial;
-
import org.papervision3d.materials.utils.MaterialsList;
-
import org.papervision3d.objects.parsers.DAE;
-
import org.papervision3d.view.BasicView;
-
-
public class DaeParser_v1 extends BasicView {
-
// create a class-level var for the collada scene
-
private var _dae:DAE;
-
// create the light
-
private var _light:PointLight3D;
-
-
public function DaeParser_v1() {
-
lights();
-
init3d();
-
}
-
-
private function lights():void {
-
// create the light to the scene
-
_light = new PointLight3D(true, true);
-
// place it in the same position as the camera (0, 0, -1000);
-
_light.copyPosition(camera);
-
}
-
-
private function init3d():void {
-
// create a materials list and add the wireframe material
-
var knotMaterialsList:MaterialsList = new MaterialsList();
-
// we are now going to use a gouraud material for shading
-
var knotMaterial:GouraudMaterial = new GouraudMaterial(_light);
-
knotMaterialsList.addMaterial(knotMaterial, "all");
-
// instantiate the DAE obj and load the knot object
-
// apply the material and scale to 0.05
-
_dae = new DAE();
-
_dae.load("assets/knot2.dae", knotMaterialsList);
-
_dae.scale = 5;
-
// add the DAE file to the scene
-
scene.addChild(_dae);
-
// start rendering (activated onRenderTick)
-
startRendering();
-
}
-
-
override protected function onRenderTick(event:Event = null):void {
-
// rotate the object
-
_dae.yaw(1);
-
super.onRenderTick();
-
}
-
}
-
}
Parsing a DAE file is much like parsing an Collada file. The only real difference is when certain properties have to be set. The constructor for the DAE file allows for different commands because this file is meant more for animated 3d objects (it takes autoplay, name, and loop).
To accommodate for this, I just left the constructor blank and set the scale. I also moved the loading until after the DAE parser object was instantiated.
-
_dae = new DAE();
-
_dae.load("assets/knot2.dae", knotMaterialsList);
-
_dae.scale = 5;











Netto
_3ds.setChildMaterial I get an error (1061) on this line flash can’t find method related,please help I get a blank screen!
Netto
MarcPelland
are you working with the latest release of Papervision?
bioRex21
i’ve never used the 3ds parser, i’ll give it a try. If i put some lights in 3D Studio, will they appear in PV3D with the 3ds parser? (i guess not, but i don`t have 3d Studio to make a test right now).
Very nice article by the way, thanks.
MarcPelland
thanks for the nice comments bioRex.
I know that the 3ds parser will load the lights as objects. But I don’t believe that there is much that can be done with them. I would recommend using dummy objects, either in the 3d scene or in the papervision scene.
oliver_l1
in your example you apply a material to the collada object via code but what if the object has a material(defined in a 3d application) already applied ?
oliver_l1
and one more question…you said:
These are good files to use if you would like to import assets that include animations.
So far so good but how can i control the animation in papervision.For example a simple walk cycle animation created in Cinema 4D via keyboard input in as3 and pv3d ?
MarcPelland
I will work on creating a part 2 of this tutorial over the next couple days and see if i can answer some of your questions about animation and materials.
I can assure you that both things are possible (loading animations and using materials that were used in the 3d application).
dino
VERY NICE FILE….i’m new in papervision i see your tutorial, but i don’t understand how i can change the 3dobject. i have my .3ds file and i put in my folder,then i change the extensione in Max3dsParser_v1 and export the .fla…. i need to know if the Max3dsParser_v1.as is remain the same or is an .as created from 3dstudio?
MarcPelland
just find knot.3ds within the Max3dsParser_v1.as and change that to the name of your 3ds file. the rest can remain the same
dino
doesn’t work…maybe my exporto in .3ds is wrong? i can’t see my file but still remain your knot.3ds…!!
ED Hardy
It’s good to see this information in your post, i was looking the same but there was not any proper resource, thanx now i have the link which i was looking for my research.
Prada Handbags
What a fun pattern! It’s great to hear from you and see what you’ve sent up to. All of the projects look great! You make it so simple to this.Thanks!
air max pas cher
Very happy to see your article, I very much to like and agree with your point of view. Thank you for sharing. At the same time,i love best pram very much .Welcome to look at my website and blog articles.Hope we can become good friends, and exchange and to help each other! Thanks!!
wart
Are there other more tutorials like this one?? it’s good! thanks a lot! but, you try to consider adding up more explanations for the first timers. =)
laptop battery dell
Good work! Ii would look forword your article. Maybe you can come to my website to search what you need~
welcome everyone come to my website!
cheap acer laptop battery
Good work! Ii would look forword your article. Maybe you can come to my website to search what you need~
CA Bikini
You are the bomb! What a wealth of knowledge you share. Love to read your articles.
coach outlet
This has been very helpful understanding a lot of things. I’m sure a lot of other people wil
Christian Louboutin pumps
Amazing talent. I find her designs to be extraordinary!I agree this point.
Christian Louboutin Boots
cheap nike free shoes
What a great post! Just one suggestion:If you add some pics, it would be easiler to follow!
Nike Air Force Ones Shoes
Your post is excellent. I learn much from your article. Life is a
传奇私服
I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
传奇私服
传奇私服