1. 需要有一个被选择的mesh,通过raycaster获取
2. 创建先和一个平面
3. 将线和标注的面放在获取的mesh上
var mouse =new THREE.Vector2();
var raycaster =new THREE.Raycaster();
mouse.x = (event.clientX / domElement.width) *2 -1;
mouse.y = -(event.clientY / domElement.height) *2 +1;
raycaster.setFromCamera(mouse, camera);
var intersects = raycaster.intersectObjects(scene.children, false); //
selectedObject = intersects[0].object; // 被选中的标注对象
//
var startP,endP;// 这里也是通过raycaster获取到的
var color = parameters.hasOwnProperty("color") ? parameters.color :0x0000ff;
var lineMat =new THREE.LineBasicMaterial({
"color": 0xff0000
});
var lineGeo =new THREE.Geometry();
lineGeo.vertices.push(startPos);
lineGeo.vertices.push(endPos);
var line =new THREE.Line(lineGeo, lineMat