Could someone help to understand how raycasting works?

Go review what the parameters are for Raycast

Hint: they are NOT two positions. :slight_smile:

Also… always use named arguments with Physics.Raycast() because it contains many poorly-designed overloads:

https://discussions.unity.com/t/758115/8