Ray casting uses two parameters, one of the origin position and the other of the direction, however, what I need is for it to ray cast from one point to another point.
You calculate the vector from point A to point B with
ABvector = pointB - pointA
1 | local pointA = Vector 3. new( 1 , 1 , 1 ) |
2 | local pointB = Vector 3. new(- 1 , 1 , 0 ) |
3 | local ABvector = pointB - pointA |
4 |
5 | -- Cast a ray from pointA to pointB |
6 | local ray = Ray.new(pointA, ABvector) |