Autodesk Forge Viewer getting fragment position

你说的曾经没有我的故事 提交于 2021-01-29 14:08:35

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/64749870/autodesk-forge-viewer-getting-fragment-position

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!