The direction argument is not where it ends, it’s where it’s going to. There’s a clear difference. Here’s a visual example:
Direction
The direction is for where the ray travels, so if you add the origin point with the direction, that’s where the ray ends.
To solve the issue, just subtract the origin position with the target position and you would get the direction:
local Direction = origin - direction
local ray = Ray.new(origin,Direction)
