Autodesk Forge Viewer获取片段位置 [英] Autodesk Forge Viewer getting fragment position

查看:100
本文介绍了Autodesk Forge Viewer获取片段位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取模型中各个网格的位置(从revit文件翻译而来).我正在做的是获取fragmentProxy,然后使用getOriginalWorldMatrix()获得THREE.Matrix4().然后从Matrix4中,调用getPosition()以获取片段的THREE.Vector3世界位置.但是,每个网格都返回相同的位置值.那是因为模型最初是如何构建的?还是我必须使用其他方法来获取片段位置?

I'm trying to get the position of separate meshes in a model (translated from a revit file). What I'm doing is to get fragmentProxy, then use getOriginalWorldMatrix() to get the THREE.Matrix4(). Then from the Matrix4, call getPosition() to get the THREE.Vector3 world position of the fragment. However, every mesh returns the same position value. Is that because of how the model is built originally? Or I have to get the fragment position using a different method?

推荐答案

您检索片段转换的过程是正确的.或者,您可以使用类似以下的内容:

Your process of retrieving the fragment transform is correct. Alternatively, you could use something like this:

function getFragmentTransform(model, fragid) {
    const frags = model.getFragmentList();
    let xform = new THREE.Matrix4();
    frags.getOriginalWorldMatrix(fragid, xform);
    return xform;
}

恐怕您是正确的,在某些情况下,变换可能会直接烘焙到网格顶点中.

I'm afraid you are correct that, in some cases, the transform may be baked directly into the mesh vertices.

这篇关于Autodesk Forge Viewer获取片段位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆