The second argument of :Raycast is direction, not destination. This is a directional vector relative to the origin (first argument), with a length that you want to cast.
You could replace endPos with endPos - origin and likely solve your issue
The second argument of :Raycast is direction, not destination. This is a directional vector relative to the origin (first argument), with a length that you want to cast.
You could replace endPos with endPos - origin and likely solve your issue