What i'm trying to achieve is making a laser beam connect 2 points in space.
I was thinking that maybe by rendering a lineGeometry and appending 6 planes rotated on x axis will do the trick, but it seems like it's more complicated.
This is how I generate the laser beam, so far so good
window.lazor = new THREE.Object3D();
var material = new THREE.MeshBasicMaterial({
blending : THREE.AdditiveBlending,
color : 0x4444aa,
side : THREE.DoubleSide,
depthWrite : false,
transparent : true
})
var geometry = new THREE.PlaneBufferGeometry(100, 0.1)
var nPlanes = 3;
for(var i = 0; i < nPlanes; i++){
var mesh = new THREE.Mesh(geometry, material)
mesh.rotation.x = i/nPlanes * Math.PI
lazor.add(mesh);
}
window.lazor.rotation.y = Math.PI / 2
What i'm looking into is to render both ends of the object3D to 2 points(Vec3).
Line geometry seems to do the trick (length will always be equal to the distance between the 2 points), by updating the second vertice to the Vector3 it needs to connect with every frame, but i'm not confident on what approach should I take using the `Object3D (I'm not sure how to find out where each end of the Object3D is located)