public override void checkClassifier(EmbodiedClassifier classifier) { //look at whether the gesture being performed is close to the surface of the Earth float dist = IMRE.Math.Operations.magnitude((float3)RSDESManager.earthPos - classifier.origin); if (Unity.Mathematics.math.abs(RSDESManager.EarthRadius - dist) < tolerance && Time.time > _startTime + cooldown) { //figure out when the gesture began _startTime = Time.time; //make a pin at a location on the Earth closest to where the gesture is RSDESPin.Constructor(GeoPlanetMaths.latlong(classifier.origin, RSDESManager.earthPos)); //the gesture has completed the functionality. classifier.shouldFinish = true; } }
private void Awake() { ins = this; EarthRadius = 1f; //initialize system scales to agree. SimulationTime = DateTime.UtcNow; simulationScale = earthRadius / earthTrueRadius; worldScaleModifier.ins.AbsoluteScale = simulationScale; earthPos = this.transform.position; //Debug.Log(earthRot.eulerAngles); if (sunPin == null) { RSDESPin.Constructor().setupSun(); } if (moonPin == null) { RSDESPin.Constructor().setupMoon(); } if (northPolePin == null) { RSDESPin.Constructor().setupNorthPole(); } if (southPolePin == null) { RSDESPin.Constructor().setupSouthPole(); } onEarthTilt += updateLatLongLines; onEarthTilt += SetSunMoonPositions; onEarthTilt += updateNightSky; onEarthTilt += updatePoleLine; //resetEarthTilt(); }
private void SetSunMoonPositions() { Vector3 EarthOffset = Vector3.zero; if (Horizons.planetsHaveValues) { EarthOffset = Horizons.Planets.Find(p => p.id == 399).position; } if (Sun != null && sunPin != null && Horizons.planetsHaveValues) { if (sunBetweenTropics) { Vector2 tmp = GeoPlanetMaths.latlong(Horizons.Planets.Find(p => p.id == 10).position - EarthOffset); tmp.x = (tmp.x / realEarthtilt) * earthTiltDeg; sunPin.Latlong = tmp; } else { sunPin.Latlong = GeoPlanetMaths.latlong(Horizons.Planets.Find(p => p.id == 10).position - EarthOffset); } } else { Debug.LogWarning("Sun, " + Sun + " ,or Sunpin, " + sunPin + " ,are not set."); RSDESPin.Constructor().GetComponent <RSDESPin>().setupSun(); } if (Moon != null && moonPin != null && Horizons.planetsHaveValues) { moonPin.Latlong = GeoPlanetMaths.latlong(Horizons.Planets.Find(p => p.id == 301).position - EarthOffset); } else { Debug.LogWarning("moon, " + Moon + " ,or moonpin, " + moonPin + " ,are not set."); RSDESPin.Constructor().GetComponent <RSDESPin>().setupMoon(); } }