# How to check if a line casted from one point to another point passes through a mesh?

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.

• Presumably you considered computing the offset vector from A to B, then passing A as the origin, (B - A) normalized as the direction, and the length of (B-A) as the far value? Did anything impede this from working in your tests? May 29 at 15:10
• @DMGregory Thank You so much. It's working. I didn't know it could be done so easily. May 29 at 15:15

const a = new Vector3(xa, ya, za);
$$$$
`