I am attempting to create a for loop consisting of 10 lines. However, I am encountering an error with line.Clone() as it is unable to find any mesh to clone from. If you have any insights on how to access the mesh of a line, please share.
Below is the code snippet:
forward_RT(){
var spotLight = new THREE.SpotLight( 0xffffff ); //White Color
spotLight.position.set( 150, 500, -210 );
scene_Main.add( spotLight );
var material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
var geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3( spotLight.position.x, spotLight.position.y, spotLight.position.z) );
geometry.vertices.push(new THREE.Vector3( ray_End_pos_X, ray_End_pos_Y, ray_End_pos_Z) );
var line = new THREE.Line( geometry, material );
for(var i=0; i<10; i++){
//Also tried
//var newLine = line.clone(); & scene_Main.add(newLine);
scene.add(line.clone());
ray_End_pos_X += 50;
}
}