I need help with some logic in my script. I created a dynamic day/night cycle that works fine in itself, but I want to add a game clock that works off the initial position of the sun (Directional Light).
I was thinking that it could be achieved by Shooting a ray from the directional light to the terrain and computing an angle which i would use to estimate the time.
- Would ray casting be the best/ most efficient way to do this?
- Is it even possible to achieve what I'm asking for, if not is there a method that better suits what I need?
So to go over.. I want the user to be able to place the sun anywhere along the x axis that would rotate around the terrain, when the user is satisfied with the position they chose, on startup of the game I would like my script to calculate the current position of the sun and then estimate the current time.
I can take care of the actual clock after that point but is ray casting from the sun to the terrain the way to go about something like this or should I be looking at this in totally different way?