raycast from a to b unity code example
Example: unity draw ray from one object to another
Debug.DrawRay(a.transform.position, (b.transform.position - a.transform.position) * maxDistance, Color.Green);
Debug.DrawRay(a.transform.position, (b.transform.position - a.transform.position) * maxDistance, Color.Green);