I've attempted a thorough search, but unfortunately, I haven't come across any solutions that address my issue:
I have a vector and a CylinderGeometry Mesh. My goal is to make the cylinder face the direction indicated by the vector. The input parameters include a position (c) and a direction (m) similar to a line equation (y = mx + c):
function draw (m,c, _color) {
//... create the geometry and mesh
// set the position
line.position.x = c.x;
line.position.y = c.y;
line.position.z = c.z;
// I attempted something along these lines:
line.lookAt(c.add(m));
//.. then add to scene
}
However, it seems like the direction is opposite of what I intend to achieve.
Moreover, I experimented with translation techniques:
geometry.applyMatrix( new THREE.Matrix4().makeTranslation(0, length/2, 0));
I also tried manually calculating the rotation using
line.rotation.x = direction.angleTo(vec3(1,0,0))* 180 / Math.PI;
. Unfortunately, none of these methods provided the desired outcome.