public override void pinFunction(RSDESPin pin, EmbodiedClassifier classifier)
 {
     if (pin != null)
     {
         pin.toggleHorizonPlane();
     }
 }
 public override void pinFunction(RSDESPin pin, EmbodiedClassifier classifier)
 {
     if (pin != null)
     {
         pin.toggleTerminator();
     }
 }
Ejemplo n.º 3
0
 public static Vector3 directionFromLatLong(this RSDESPin pin)
 {
     if (RSDESManager.verboseLogging && pin == null)
     {
         Debug.Log("dead pin", pin);
     }
     return(directionFromLatLong(pin.Latlong));
 }
Ejemplo n.º 4
0
 public pinData(RSDESPin pin, Vector3 contactPoint)
 {
     RSDESManager.onEarthTilt += pin.onEarthTilt;
     this.pin          = pin;
     this.contactPoint = contactPoint;
     this.latLong      = GeoPlanetMaths.latlong(contactPoint, RSDESManager.earthPos);
     //pin.Latlong = this.latLong;
 }
Ejemplo n.º 5
0
        public static RSDESPin Constructor(Vector2 latlong)
        {
            RSDESPin pin = Instantiate(Resources.Load <GameObject>("Prefabs/RSDES/RSDESpushPinPrefab"))
                           .GetComponent <RSDESPin>();

            pin.Latlong = latlong;
            pin.setupPin();
            return(pin);
        }
Ejemplo n.º 6
0
 protected override void WhenGestureDeactivated(Hand maybeNullHand, DeactivationReason reason)
 {
     if ((reason == DeactivationReason.CancelledGesture && !forgiving) || reason == DeactivationReason.FinishedGesture)
     {
         if (pinA != null || pinB != null)
         {
             playErrorSound();
         }
         pinB = null;
         pinA = null;
     }
 }
Ejemplo n.º 7
0
        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;
            }
        }
Ejemplo n.º 8
0
        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();
        }
Ejemplo n.º 9
0
        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();
            }
        }
Ejemplo n.º 10
0
 public override float3 pinDirection(RSDESPin pin)
 {
     return(new float3(0f, 1f, 0f));
 }
Ejemplo n.º 11
0
 public static Vector3[] terminatorOfStar(this RSDESPin pin)
 {
     return(terminatorOfStar(directionFromLatLong(pin.Latlong), RSDESManager.earthPos, RSDESManager.LR_Resolution));
 }
Ejemplo n.º 12
0
 public static Vector3[] latAtPoint(this RSDESPin pin)
 {
     return(latAtPoint(directionFromLatLong(pin.Latlong) * RSDESManager.EarthRadius + RSDESManager.earthPos, RSDESManager.LR_Resolution));
 }
 public override Unity.Mathematics.float3 pinDirection(RSDESPin pin)
 {
     return((Unity.Mathematics.float3)pin.directionFromLatLong());
 }
 public abstract float3 pinDirection(RSDESPin pin);
 public abstract void pinFunction(RSDESPin pin, EmbodiedClassifier classifier);
Ejemplo n.º 16
0
        protected override void WhileGestureActive(Hand hand)
        {
            if (RSDESManager.ins != null)
            {
                RSDESPin bestPin = null;
                float    dist    = Mathf.Infinity;
                foreach (pinData currPinData in RSDESManager.ins.PinnedPoints)
                {
                    if ((currPinData.pin.pinHead.transform.position - fingerTip(hand)).magnitude < dist && isPointingAt(currPinData.pin.pinHead, hand))
                    {
                        dist    = (currPinData.pin.pinHead.transform.position - fingerTip(hand)).magnitude;
                        bestPin = currPinData.pin;
                    }
                }

                if (dist < distanceTolerance && bestPin != null)
                {
                    if (pinA == null && pinB == null)
                    {
                        pinA = bestPin;
                        playPositiveSound();
                        pinA.playParticleEffect();
                    }
                    else if (pinA != null && pinB == null && bestPin != pinA)
                    {
                        pinB = bestPin;
                        pinB.playParticleEffect();


                        RSDESManager.ins.instantiateGreatArc(pinA.dbPinData, pinB.dbPinData);
                        playCompleteSound();

                        RSDESPin tmp;
                        tmp  = pinA;
                        pinA = pinB;
                        pinB = tmp;
                    }
                    else                     //pinA & pinB are set
                    {
                        if (bestPin == pinB)
                        {
                            RSDESManager.ins.instantiateGreatCircle(pinA.dbPinData, pinB.dbPinData);
                            playCompleteSound();
                            pinA.playParticleEffect();

                            pinA = pinB;
                            pinB = null;
                        }
                    }


                    #region Old Stuff
                    //	if (pinA != null && (bestPin != null && bestPin != pinB))
                    //		pinB = pinA;

                    //	if (pinB != null && bestPin == pinB)
                    //	{
                    //		//if(RSDESManager.verboseLogging)
                    //		Debug.Log("DRAW CIRCLE");
                    //		//draw circle
                    //		RSDESManager.ins.instantiateGreatCircle(bestPin.dbPinData, pinA.dbPinData);
                    //		pinB = null;
                    //	}
                    //	else if (pinB != null)
                    //	{
                    //		//if (RSDESManager.verboseLogging)
                    //		Debug.Log("DRAW ARC");
                    //		//draw arc
                    //		RSDESManager.ins.instantiateGreatArc(bestPin.dbPinData, pinA.dbPinData);
                    //	}
                    //	else
                    //	{
                    //		Debug.LogError("Pin B is null within " + name);
                    //	}
                    //	pinA = bestPin;
                    //	pinA.playParticleEffect();
                    //	gestureComplete = true;
                    //}
                    //else if (dist < distanceTolerance)
                    //{
                    //	pinA = bestPin;
                    //}
                    #endregion
                }
            }
        }
Ejemplo n.º 17
0
 public override float3 pinDirection(RSDESPin pin)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 18
0
 public override void pinFunction(RSDESPin pin, EmbodiedClassifier classifier)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 19
0
 public override void pinFunction(RSDESPin pin, EmbodiedClassifier classifier)
 {
     pin.Latlong = GeoPlanetMaths.latlong(classifier.origin, RSDESManager.earthPos);
 }