void Update() { if (celestialOrigin.coordinateType != CelestialCoordinateType.Horizontal) { text.text = ""; return; } switch (coordsType) { case CelestialCoordinateType.Horizontal: default: var horiz = new HorizontalCoords(cameraRotation.value); text.text = $"Az: {horiz.azimuth.ToString("0.0")}\nAlt: {horiz.altitude.ToString("0.0")}"; break; case CelestialCoordinateType.Equatorial: var rot = Quaternion.Inverse(equatorialOrigin.value) * cameraRotation.value; var equ = new EquatorialCoords(rot); text.text = $"RA: {equ.rightAscention.ToString("0.0")}\nDec: {(equ.declination).ToString("0.0")}"; break; case CelestialCoordinateType.Ecliptic: var ecl = EclipticCoords.FromQuaternionUntested(cameraRotation.value); text.text = $"Lon: {ecl.longitude.ToString("0.0")}\nLat: {ecl.latitude.ToString("0.0")}"; break; } }
void Update() { var lst = StarMath.LocalSiderealTime(astrobodiesSO.value, geocoordsSO.value, day.value); var obl_ecl = StarMath.ObliquityOfEcliptic(day.value); // var dirVernalEq_equatorial = new EquatorialCoords(0,0); var dirVernalEquinox_equ = new EquatorialCoords(0, 0); var dirCelestialPole_equ = new EquatorialCoords(0, 90); if (correctForPrecession) { dirVernalEquinox_equ = dirVernalEquinox_equ.ToCorrectedPrecession(day.value, obl_ecl); dirCelestialPole_equ = dirCelestialPole_equ.ToCorrectedPrecession(day.value, obl_ecl); } var dirVernalEquinox_vec = dirVernalEquinox_equ.ToVector3(); var dirCelestialPole_vec = dirCelestialPole_equ.ToVector3(); Vector3 dirForward, dirUp; switch (coordinateType) { default: case CelestialCoordinateType.Horizontal: dirForward = dirVernalEquinox_equ .ToHorizontal(geocoordsSO.value, lst) .ToVector3(); dirUp = dirCelestialPole_equ .ToHorizontal(geocoordsSO.value, lst) .ToVector3(); break; case CelestialCoordinateType.Equatorial: dirForward = dirVernalEquinox_vec; dirUp = dirCelestialPole_vec; break; case CelestialCoordinateType.Ecliptic: dirForward = Vector3.forward; dirUp = Vector3.up; break; } transform.localRotation = Quaternion.LookRotation(dirForward, dirUp); equatorialOrigin.value = Quaternion.LookRotation(dirVernalEquinox_vec, dirCelestialPole_vec); }