Let's say we have two vectors A and B. Is there a way to use Three.js' Ray or Raycaster classes to cast a line between vector A and vector B and check is it passes through a mesh in the scene? I know from the documentation that both the Ray and Raycaster classes accept origin and direction vectors but I specifically need two points. Thanks in advance.
As @DMGregory answered in the comment it can be done this way:
const a = new Vector3(xa, ya, za); const b = new Vector3(xb, yb, zb); const c = b.clone().sub(a); const far = c.length(); const raycaster = new Raycaster(b, c.normalize(), 0, far); const intersections = raycaster.intersectObjects(scene); ```