问题
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