How can I check if "sun" reach some characters?

Hi All!

Is there any solution to reach that when my character go out and the sun light reach it, then it takes damage?
I try to create a zombie like game, but when the “zombies” go out and the sun reach them, then it takes damage, but if they move in to the shadow, nothing happening.

Thanks in advance!!

Cheers guys!
Gabor

You could just do a simple ray trace check from the sun. Get the vector between the sun and the character and cast a ray in that direction. As long as the ray doesn’t hit the character, no damage is taken. When the ray hits the character, damage is dealt.