Example #1
0
        private static void HardsetOrbit(OrbitDriver orbitDriver, Orbit newOrbit)
        {
            Log.Info("HardsetOrbit");
            var orbit = orbitDriver.orbit;

            orbit.inclination         = newOrbit.inclination;
            orbit.eccentricity        = newOrbit.eccentricity;
            orbit.semiMajorAxis       = newOrbit.semiMajorAxis;
            orbit.LAN                 = newOrbit.LAN;
            orbit.argumentOfPeriapsis = newOrbit.argumentOfPeriapsis;
            orbit.meanAnomalyAtEpoch  = newOrbit.meanAnomalyAtEpoch;
            orbit.epoch               = newOrbit.epoch;
            orbit.referenceBody       = newOrbit.referenceBody;
            orbit.Init();
            orbit.UpdateFromUT(Planetarium.GetUniversalTime());
            if (orbit.referenceBody != newOrbit.referenceBody)
            {
                if (orbitDriver.OnReferenceBodyChange != null)
                {
                    orbitDriver.OnReferenceBodyChange(newOrbit.referenceBody);
                }
            }
            RateLimitedLogger.Log(HardsetOrbitLogObject,
                                  string.Format("Orbit \"{0}\" changed to: inc={1} ecc={2} sma={3} lan={4} argpe={5} mep={6} epoch={7} refbody={8}",
                                                orbitDriver.OrbitDriverToString(), orbit.inclination, orbit.eccentricity, orbit.semiMajorAxis,
                                                orbit.LAN, orbit.argumentOfPeriapsis, orbit.meanAnomalyAtEpoch, orbit.epoch, orbit.referenceBody.CbToString()));
        }
Example #2
0
        private static void HardsetOrbit(OrbitDriver orbitDriver, Orbit newOrbit)
        {
            var orbit = orbitDriver.orbit;

            orbit.inclination         = newOrbit.inclination;
            orbit.eccentricity        = newOrbit.eccentricity;
            orbit.semiMajorAxis       = newOrbit.semiMajorAxis;
            orbit.LAN                 = newOrbit.LAN;
            orbit.argumentOfPeriapsis = newOrbit.argumentOfPeriapsis;
            orbit.meanAnomalyAtEpoch  = newOrbit.meanAnomalyAtEpoch;
            orbit.epoch               = newOrbit.epoch;
            orbit.referenceBody       = newOrbit.referenceBody;
            orbit.Init();
            orbit.UpdateFromUT(Planetarium.GetUniversalTime());
            if (orbit.referenceBody != newOrbit.referenceBody)
            {
                orbitDriver.OnReferenceBodyChange?.Invoke(newOrbit.referenceBody);
            }
            RateLimitedLogger.Log(HardsetOrbitLogObject,
                                  $"Orbit \"{orbitDriver.OrbitDriverToString()}\" changed to: inc={orbit.inclination} ecc={orbit.eccentricity} sma={orbit.semiMajorAxis} lan={orbit.LAN} argpe={orbit.argumentOfPeriapsis} mep={orbit.meanAnomalyAtEpoch} epoch={orbit.epoch} refbody={orbit.referenceBody.CbToString()}");
        }
Example #3
0
 private static void HardsetOrbit(OrbitDriver orbitDriver, Orbit newOrbit)
 {
     var orbit = orbitDriver.orbit;
     orbit.inclination = newOrbit.inclination;
     orbit.eccentricity = newOrbit.eccentricity;
     orbit.semiMajorAxis = newOrbit.semiMajorAxis;
     orbit.LAN = newOrbit.LAN;
     orbit.argumentOfPeriapsis = newOrbit.argumentOfPeriapsis;
     orbit.meanAnomalyAtEpoch = newOrbit.meanAnomalyAtEpoch;
     orbit.epoch = newOrbit.epoch;
     orbit.referenceBody = newOrbit.referenceBody;
     orbit.Init();
     orbit.UpdateFromUT(Planetarium.GetUniversalTime());
     if (orbit.referenceBody != newOrbit.referenceBody)
     {
         orbitDriver.OnReferenceBodyChange?.Invoke(newOrbit.referenceBody);
     }
     RateLimitedLogger.Log(HardsetOrbitLogObject,
         $"Orbit \"{orbitDriver.OrbitDriverToString()}\" changed to: inc={orbit.inclination} ecc={orbit.eccentricity} sma={orbit.semiMajorAxis} lan={orbit.LAN} argpe={orbit.argumentOfPeriapsis} mep={orbit.meanAnomalyAtEpoch} epoch={orbit.epoch} refbody={orbit.referenceBody.CbToString()}");
 }