views:

184

answers:

1

Hey everyone, I'm working with Collada files and I need them to be a certain size. When instantiating them in pv3d you set the filename, materials, and scale. Scale works like a percentage, and there's no way to get the width, height, or depth of the DAE once in flash. I want to be able to specify the size of DAE in 3D space relative to other pv3d native geometry.

A: 

You can try to calculate that using the Axis Aligned Bounding Box (AABB).

In the complete handler, access the aabb of the object containing geometry. Based on how nested your DAE objects are, you might need to go down the hierarchy a bit to get to the objects that actually contain geometry, as the .geometry property, which holds aabb is null for empty container.

e.g.

//in the complete handler, assuming object is a reference to a DisplayObject3D of the collada
//containing geometry
trace('width: ' + (object.geometry.aabb.maxX - object.geometry.aabb.minX)); 
            trace('height: ' + (object.geometry.aabb.maxY - object.geometry.aabb.minY)); 
            trace('depth: ' + (object.geometry.aabb.maxZ - object.geometry.aabb.minZ));

HTH, George

George Profenza