开发者

Papervision 3D: How can I force dimensions on a collada file

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 开发者_StackOverflow中文版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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜