1. 获取点击位置(鼠标点到构件才会有反应)
// 绑定到h5点击事件
console.log(" >LJason< 日志:点击位置",viewer.clientToWorld(event.offsetX,event.offsetY,false).intersectPoint);
  1. 获取构件中心点
// 下面方法拿到构件的AABB包围盒的两个点,中心点算一下吧
var tree = viewer.model.getData().instanceTree;
var tmpBox = new Float32Array(6);
tree.getNodeBox(dbId, tmpBox);

var min = new THREE.Vector3(tmpBox[0], tmpBox[1], tmpBox[2]);
var max = new THREE.Vector3(tmpBox[3], tmpBox[4], tmpBox[5]);
最后修改:2023 年 08 月 01 日
如果觉得我的文章对你有用,请随意赞赏