How to get the geometry of a DAE object in Papervision3DPosted: September 10, 2010
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:
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.
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!