Hello experts!
In a function, I have created some lines and pushed these in an array.
var line = new THREE.Line( lineGeom, lineMaterial );
linesArray.push( line);
scene.add( line );
In another function, I would like to loop through the array and get a sense of the angle between each line and the camera vector with the scalar product of the 2 vectors. I tried this:
for (var i = 0; i < linesArray.length; i++) {
lineObj = linesArray[i];
var dir = new THREE.Vector3(0,0,1);
dir.applyQuaternion( lineObj.quaternion );
dir.normalize();
...
}
but I can’t get the line vector as I can with other kind of geometries. I also tried:
var matrix = new THREE.Matrix4();
matrix.extractRotation( lineObj.matrix );
var direction = new THREE.Vector3( 0, 0, 1 );
direction.applyMatrix4(matrix);
without better success.
Thank you for any help guys!