Why is the texture of my DAE file not loading?

If you wondering why the texture of your DAE file is not shown in Papervision nameconflicts can be the reason:

Go into you DAE file, look for the ‘symbol’  attribute in the  <instance_material … > Tag and compare the value with the one you assigned to the name parameter in your addMaterial() statement.

‘symbol’ attribute value in dae file == ‘name’ parameter in addMaterial() method

Advertisements

Why i dont see my RigidBody object …

I was wondering why i dont see my RigidBody object in my jiglib physicalized Papervision3D scene.

var visualObject:DAE = new DAE(“elipsoide.dae”);
var visualObjectMesh:P3DMesh = new P3DMesh(visualObject);
var physicalObject:RigidBody = new JSphere(visualObjectMesh, 10);

var physics:Papervision3DPhysics = new Papervision3DPhysics(scene, 10);
physics.addBody(physicalObject);

Who has the answer?

I forgot to add the visualObject to the scene:

var visualObject:DAE = new DAE(“elipsoide.dae”);
scene.addChild(visualObject);
var visualObjectMesh:P3DMesh = new P3DMesh(visualObject);
var physicalObject:RigidBody = new JSphere(visualObjectMesh, 10);

var physics:Papervision3DPhysics = new Papervision3DPhysics(scene, 10);
physics.addBody(physicalObject);

So always remember – the visualObject is the “visual” representation of the physicalObject – while the physicalObject is the “physical” representation of the visualObject. Sounds logic but i had to make this clear to me….

So the answer to my question must be:
You can’t see a RigidBody object!


How to embed a COLLADA (.dae) file into swf?

Just simply as you would embed other sources in Flash:

[Embed (source=”assets/yourColladaFile.dae”,mimeType=”application/octet-stream”)]
private var Model:Class;

var myDAE:DAE = new DAE();
myDAE.load(new Model());

thats it!


How to get the geometry of a DAE object in Papervision3D

Lately i was looking for a way to get the geometry of a DAE DisplayObject3D in Papervision. Normaly you can get the geometry property of a DO3D by accessing myDO3D.geometry. But as soon as you try to get it from a DAE object, the geometry property returns null. After some googleling i found a solution to my problem:

var geometry:GeometryObject3D = myDAE.getChildByName(“COLLADA_Scene”).getChildByName(“nameOfTheObject”).geometry;
for short you can also write:
var geometry:GeometryObject3D = myDAE.getChildByName(“nameOfTheObject”, true).geometry; // note the true flag for recursive search

Now we can get things like calculating a BoundingBox ore better – a BoundingSphere by accessing the boundingSphere property like this:
geometry.boundingSphere

Notice! If you for exsample want to get the real dimension of the BoundingSphere in the scene you have to thake account of the actual scale faktor of the myDAE object.

Example:

var myDAEWidthAndHight:Number = myDAE.scale * geometry.boundingSphere.radius;

I agree with you that this is quite a ugly hack – but it was the only way to access the geometry prop.  Better ways of doing that are welcome!