今天客户这边的需求是要动态的延长线段,线段动态与单击点相连
function createTrack(THREE,start,end){
let points=[]
var material = new THREE.LineBasicMaterial({
color: 0xff0000
});
var geometry = new THREE.BufferGeometry();
points.push(start);
points.push(end);
geometry.setFromPoints(points)
var line = new THREE.Line( geometry, material );
userMeshGroup.add(line)
viewer3D.render();
this.addPiont=function(x,y,z){
points.push(new THREE.Vector3(x,y,z));
line.geometry.setFromPoints(points)
viewer3D.render();
}
}
这里需要注意的主要是BufferGeometry,如果要是用Geometry,那么就不能这么实现,具体原因没有做深究。
网友评论