// 获取对象的包围盒
getObjboundsById(objId){
    var box = new THREE.Box3();
    var bounds = new THREE.Box3();
    var instanceTree = viewer.model.getData().instanceTree;
    var fragList = viewer.model.getFragmentList();
    box.makeEmpty();
    bounds.makeEmpty();
    instanceTree.enumNodeFragments(objId, function (fragId) {
        fragList.getWorldBounds(fragId, box);
        bounds.union(box)
    }, true)

    return bounds
}
 // 获取中心位置
getObjPosition(dbId){
    var bound = vmethods.getObjboundsById(dbId);
    var posx = (bound.max.x + bound.min.x) / 2;
    var posy = (bound.max.y + bound.min.y) / 2;
    var posz = (bound.max.z + bound.min.z) / 2;
    var pos = {
        x:posx,
        y:posy,
        z:posz
    }
    return pos;
}

weijie
164 声望7 粉丝