I’m creating a game in which the player’s health goes down when not in the shade. I’ve created a script that shoots a ray cast from the player to the directional light and that seems to work.
The problem I’m having is with is the day/night system. I currently have the directional light orbiting the level using a free asset from the store. However, orbiting the level does not change the shadows so the player isn’t losing health(because the directional light is below the ground) but isn’t visible in the shade. One possible solution I can think of (which I’m not sure will actually work) is to place an object underground and have the directional light constantly point at it as it orbits.
When looking for the answer in other posts most say just rotate the directional light and leave it stationary, however that wouldn’t work in my case because a raycast is shot from the player to the sun. I’m fairly new to game development and coding in general so if anyone knows of any easier way any help would be greatly appreciated. ,I’m creating a game in which the player’s health goes down when not in the shade. I’ve created a script that shoots a ray cast from the player to the directional light and that seems to work.
The problem I’m having is with is the day/night system. I currently have the directional light orbiting the level using a free asset from the store. However, orbiting the level does not change the shadows so the player isn’t losing health(because the directional light is below the ground) but isn’t visible in the shade. One possible solution I can think of (which I’m not sure will actually work) is to place an object underground and have the directional light constantly point at it as it orbits.
When looking for the answer in other posts most say just rotate the directional light and leave it stationary, however that wouldn’t work in my case because a raycast is shot from the player to the sun. I’m fairly new to game development and coding in general so if anyone knows of any easier way any help would be greatly appreciated.