在实际应用中需要显示出一些物体的移动轨迹,比如模拟激光切割钢板时,钢板上需要显示激光发射头在钢板上切割的轨迹。`
关键代码:
pathGeometry
= new THREE.BufferGeometry();
pathVertices
= new Float32Array(pathPointsBuf
);
pathGeometry
.setAttribute('position', new THREE.BufferAttribute(pathVertices
, 3));
var pathMaterial
= new THREE.LineBasicMaterial({
color
: 0xff0000
});
pathLine
= new THREE.Line(pathGeometry
, pathMaterial
);
...
pathPointsBuf
.push(fire
.position
.x
, 410, fire
.position
.z
);
pathVertices
= new Float32Array(pathPointsBuf
);
pathGeometry
.setAttribute('position', new THREE.BufferAttribute(pathVertices
, 3));
scene
.add(pathLine
);
转载请注明原文地址:https://ipadbbs.8miu.com/read-17478.html