I'm using three.js. And line is not updated. I want to lengthen this line in realtime.
- I think, first, A line is drawn by reading the two data.
- Second, Scene and clear.
- Third, reading the third information and the extended line.
- Fourth, Scene and clear.
- Finally line is longer in realtime.
But, this line is not generated.
var geometry = new THREE.Geometry();
var material = new THREE.LineBasicMaterial ({color : 0x0100FF, linewidth : 6});
function line_(k){
if(k-1 >= 0){
geometry.vertices.push (new THREE.Vector3 (py[k]*API.Orbit_Scale ,pz[k]*API.Orbit_Scale ,px[k]*API.Orbit_Scale));
}
else{
geometry.vertices.push (new THREE.Vector3 (0,0,0));
}
line = new THREE.Line (geometry, material);
line.geometry.verticesNeedUpdate = true;
scene.add (line);
}
function animate(){
onWindowResize();
line.geometry.verticesNeedUpdate = true;
renderer.render(scene, camera);
scene.remove(line);
requestAnimationFrame(animate);
}