Skip to content

Instantly share code, notes, and snippets.

@Kolesias123
Last active August 29, 2015 14:07
Show Gist options
  • Save Kolesias123/73fb25304a2f90f5288b to your computer and use it in GitHub Desktop.
Save Kolesias123/73fb25304a2f90f5288b to your computer and use it in GitHub Desktop.
[Apocalypse] Formula matemática para el calculo del ciclo de día y noche
Hora = sv_daynight_hour
Minutos = sv_daynight_minutes
mh = 8 [Puede cambiar según la función]
h = ( Hora - mh )
m = ( Minutos / 60 )
t = h + m
//13.84 = 180 / 13
15 = 180 / 12
--------------------------
- Angulo la luz global:
--------------------------
x1 = 15 * t
Ejemplos:
- 2:30 PM:
h = ( 14 - 8 ) = 6
m = ( 30 / 60 ) = 0.5
t = ( 6 + 0.5 ) = 6.5
x1 = ( 15 * 6.5 )
x1 = 97.5 grados
- 7:45 PM:
h = ( 19 - 8 ) = 11
m = ( 45 / 60 ) = 0.75
t = ( 11 + 0.75 ) = 11.75
x1 = ( 15 * 11.75 )
x1 = 176.25 grados
--------------------------
- Angulo de Sol
--------------------------
x2 = 360 - x1
Ejemplos:
- 2:30 PM:
x1 = 97.5
x2 = 360 - 97.5
x2 = 262.5 grados
- 7:45 PM:
x1 = 176.25
x2 = 360 - 176.25
x2 = 183.75 grados
- Si x2 es 270:
x2 = 271 (270 esta bugeado)
- Cuando la hora es 8 PM a 8 AM:
x2 = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment