A basic raycast can detect colliders and we can use that for general detection. In this lesson we want to get a specific location of where the raycast hits something. To get the Vector3 (the position) of where the raycast hits another collider, we need to use a RaycastHit. It’s a parameter we can use within the Raycast.
Ray is used since we need to get the position of where the mouse is at and convert it to a world location. ScreenPointToRay provides this for us and it returns a Ray. This in turn includes both a origin (starting point) and direction, so we can use it alone for both of these. Hope that helps you understand it. If you have any other questions let me know.