How to get coordinate information in Viewer?

how to get coordinate information in Viewer?

Apr.21,2022

depends on your specific needs
1. Get the click position (click on the component to react)

// h5
console.log(" >LJason< :",viewer.clientToWorld(event.offsetX,event.offsetY,false).intersectPoint);

2. Get the component center point

// 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]);

hope to be useful ~ good luck

Menu