Autodesk forge 伪造查看器-使用查看器的InstraceTree时获取错误的x y z坐标

Autodesk forge 伪造查看器-使用查看器的InstraceTree时获取错误的x y z坐标,autodesk-forge,autodesk-viewer,autodesk-model-derivative,autodesk-data-management,Autodesk Forge,Autodesk Viewer,Autodesk Model Derivative,Autodesk Data Management,当用户单击dbId时,我正在绘制一个标签,因为我使用下面的函数来查找坐标,但它返回了一些错误的坐标,而不是正确的坐标。例如,要得到接近400的x坐标,我只能得到12.85 function getObjPosition(dbId) { const model = viewer.model; const instanceTree = model.getData().instanceTree; const fragList = model.getFragmentList();

当用户单击dbId时,我正在绘制一个标签,因为我使用下面的函数来查找坐标,但它返回了一些错误的坐标,而不是正确的坐标。例如,要得到接近400的x坐标,我只能得到12.85

function getObjPosition(dbId) {
    const model = viewer.model;
    const instanceTree = model.getData().instanceTree;
    const fragList = model.getFragmentList();

    let bounds = new THREE.Box3();

    instanceTree.enumNodeFragments( dbId, ( fragId ) => {
        let box = new THREE.Box3();
        fragList.getWorldBounds( fragId, box );
        bounds.union( box );
    }, true );

    const position = bounds.center();
    return position;
}

通过在“加载选项”中设置以下选项,尝试取消全局偏移:

const options={
   globalOffset:{x:0,y:0,z:0}
   //...
}
viewer.loadModel/start(svf, options)
viewer.loadDocumentNode(doc, geo, options)

看来我找到了解决办法

最后,我们必须使用worldToClient来获得相应的坐标。但是我想知道为什么这些东西没有在一个合适的地方记录下来,来解释像我这样的新手探索这个领域的原因


position=viewer.worldToClient(新的3.Vector3(position.x,position.y,position.z))

否,它不工作。现在x坐标变为90,之前只有12个,但对于x坐标,dbId的实际位置约为400。尝试了其他dbId,但问题相同。