Beispiel #1
0
        public static SimulatedPart Borrow(Part p, ReentrySimulation.SimCurves simCurve)
        {
            SimulatedPart part = pool.Borrow();

            part.Init(p, simCurve);
            return(part);
        }
Beispiel #2
0
        static public SimulatedPart New(Part p, ReentrySimulation.SimCurves simCurve)
        {
            SimulatedPart part = new SimulatedPart();

            part.Set(p, simCurve);
            return(part);
        }
Beispiel #3
0
        private static SimulatedPart Create()
        {
            SimulatedPart part = new SimulatedPart();

            part.cubes.BodyLiftCurve = new PhysicsGlobals.LiftingSurfaceCurve();
            part.cubes.SurfaceCurves = new PhysicsGlobals.SurfaceCurvesList();
            return(part);
        }
Beispiel #4
0
        public Vector3 Lift(Vector3 localVelocity, float dynamicPressurekPa, float mach)
        {
            Vector3 lift = Vector3.zero;

            for (int i = 0; i < count; i++)
            {
                SimulatedPart part = parts[i];
                lift += part.Lift(localVelocity, dynamicPressurekPa, mach);
            }
            return(lift);
        }
Beispiel #5
0
        public Vector3 Drag(Vector3 localVelocity, float dynamicPressurekPa, float mach)
        {
            Vector3 drag = Vector3.zero;

            for (int i = 0; i < count; i++)
            {
                SimulatedPart part = parts[i];
                drag += part.Drag(localVelocity, dynamicPressurekPa, mach);
            }

            return(-localVelocity.normalized * drag.magnitude);
        }
Beispiel #6
0
        private void Set(Vessel v, ReentrySimulation.SimCurves _simCurves)
        {
            totalMass = 0;

            var oParts = v.Parts;

            count = oParts.Count;

            simCurves = _simCurves;

            if (parts.Capacity < count)
            {
                parts.Capacity = count;
            }

            for (int i = 0; i < count; i++)
            {
                SimulatedPart simulatedPart = SimulatedPart.New(oParts[i], simCurves);
                parts.Add(simulatedPart);
                totalMass += simulatedPart.totalMass;
            }
        }
Beispiel #7
0
        private void Init(Vessel v, ReentrySimulation.SimCurves _simCurves, double startTime, int limitChutesStage)
        {
            totalMass = 0;

            var oParts = v.Parts;

            count = oParts.Count;

            simCurves = _simCurves;

            if (parts.Capacity < count)
            {
                parts.Capacity = count;
            }

            for (int i = 0; i < count; i++)
            {
                SimulatedPart simulatedPart = null;
                bool          special       = false;
                for (int j = 0; j < oParts[i].Modules.Count; j++)
                {
                    ModuleParachute mp = oParts[i].Modules[j] as ModuleParachute;
                    if (mp != null && v.mainBody.atmosphere)
                    {
                        special       = true;
                        simulatedPart = SimulatedParachute.Borrow(mp, simCurves, startTime, limitChutesStage);
                    }
                }
                if (!special)
                {
                    simulatedPart = SimulatedPart.Borrow(oParts[i], simCurves);
                }

                parts.Add(simulatedPart);
                totalMass += simulatedPart.totalMass;
            }
        }
Beispiel #8
0
        private void Set(Vessel v, ReentrySimulation.SimCurves _simCurves, double startTime, int limitChutesStage)
        {
            totalMass = 0;

            var oParts = v.Parts;

            count = oParts.Count;

            simCurves = _simCurves;

            if (parts.Capacity < count)
            {
                parts.Capacity = count;
            }

            for (int i = 0; i < count; i++)
            {
                SimulatedPart simulatedPart = null;
                bool          special       = false;
                for (int j = 0; j < oParts[i].Modules.Count; j++)
                {
                    if (oParts[i].Modules[j] is ModuleParachute)
                    {
                        special       = true;
                        simulatedPart = SimulatedParachute.New((ModuleParachute)oParts[i].Modules[j], simCurves, startTime, limitChutesStage);
                    }
                }
                if (!special)
                {
                    simulatedPart = SimulatedPart.New(oParts[i], simCurves);
                }

                parts.Add(simulatedPart);
                totalMass += simulatedPart.totalMass;
            }
        }
Beispiel #9
0
 private static void Reset(SimulatedPart obj)
 {
 }
Beispiel #10
0
 static public SimulatedPart New(Part p, ReentrySimulation.SimCurves simCurve)
 {
     SimulatedPart part = new SimulatedPart();
     part.Set(p, simCurve);
     return part;
 }
 private static void Reset(SimulatedPart obj)
 {
 }
Beispiel #12
0
 private static void Reset(SimulatedVessel obj)
 {
     SimulatedPart.Release(obj.parts);
     obj.parts.Clear();
 }