Papervision 3D:如何强制 collada 文件的尺寸

发布于 2024-08-23 01:46:30 字数 152 浏览 3 评论 0原文

我正在处理 Collada 文件,并且需要它们具有一定的大小。在 pv3d 中实例化它们时,您可以设置文件名、材质和比例。比例的工作方式类似于百分比,一旦进入 Flash,就无法获取 DAE 的宽度、高度或深度。我希望能够指定 3D 空间中 DAE 相对于其他 pv3d 原生几何体的大小。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如若梦似彩虹 2024-08-30 01:46:31

您可以尝试使用轴对齐边界框 (AABB) 来计算。

在完整的处理程序中,访问包含几何图形的对象的aabb
根据 DAE 对象的嵌套方式,您可能需要沿着层次结构向下移动
稍微了解一下实际包含几何图形的对象,如 .geometry
对于空容器,保存 aabb 的属性为 null。

例如

//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,
乔治

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文