I am trying to figure out in my current game whether a gameObject is lit by a directional light or not. Below is my image inside the Unity game engine
As my game runs around a Day/Night cycle, I need to constantly check which hex tiles are lit and which are not. I am using one directional light source in my scene and I am rotating it around the x-axis for the day night cycle.
Currently, I am using the dot product to calculate if the tile is lit by the directional light but its not very accurate.
Vector3 forward = Light.transform.TransformDirection(Vector3.forward); float dot = Vector3.Dot(forward, -(tile.transform.position - Light.transform.position));
Is there a better way to do check this inside Unity??