Jump to content

[SOLVED] Sun azimuth and elevation


photo

Recommended Posts

Hello! try something like this:

vec3 sun_dir = sun->getWorldDirection(AXIS_Z);
float azimuth = Math::atan2(sun_dir.x, sun_dir.y) * Math::Consts::RAD2DEG
float elevation = Math::acos(clamp(-sun_dir.z, -1.0f, 1.0f)) * Math::Consts::RAD2DEG - 90.0f

 

  • Like 1
  • Thanks 1
Link to comment
  • silent changed the title to [SOLVED] Sun azimuth and elevation
×
×
  • Create New...