detect shadows with raycast

how can I detect the shadows of objects? I wish that every time the player via raycast has a shadow you write a sentence.

try one of these