Beispiel #1
0
        public static void SetOrbit(this Vessel vessel, Orbit newOrbit)
        {
            //var originalUp = FlightGlobals.getUpAxis ();
            //Log.Info ("originalUp: " + originalUp.ToString ());

            var destinationMagnitude = newOrbit.getRelativePositionAtUT(Planetarium.GetUniversalTime()).magnitude;

            if (destinationMagnitude > newOrbit.referenceBody.sphereOfInfluence)
            {
                Extensions.ErrorPopup("Destination position was above the sphere of influence");
                return;
            }
            if (destinationMagnitude < newOrbit.referenceBody.Radius)
            {
                Extensions.ErrorPopup("Destination position was below the surface");
                return;
            }

            FlightGlobals.fetch.SetShipOrbit(newOrbit.referenceBody.flightGlobalsIndex, newOrbit.eccentricity, newOrbit.semiMajorAxis, newOrbit.inclination, newOrbit.LAN, newOrbit.meanAnomalyAtEpoch, newOrbit.argumentOfPeriapsis, newOrbit.ObT);
            FloatingOrigin.ResetTerrainShaderOffset();

            try
            {
                OrbitPhysicsManager.HoldVesselUnpack(60);
            }
            catch (NullReferenceException)
            {
                Log.Info("OrbitPhysicsManager.HoldVesselUnpack threw NullReferenceException");
            }
        }
Beispiel #2
0
 public static void PutInOrbitAround(CelestialBody body, double altitude, double inclination)
 {
     FlightGlobals.fetch.SetShipOrbit(body.flightGlobalsIndex, 0, altitude + body.Radius, inclination, 0, 0, 0, 0);
     FloatingOrigin.ResetTerrainShaderOffset();
 }