Update() public method

public Update ( UnityEngine.Vector3d localAcceleration, UnityEngine.Vector3d rotation, double deltaTime, double ventingAcc, double fuelRatio ) : void
localAcceleration UnityEngine.Vector3d
rotation UnityEngine.Vector3d
deltaTime double
ventingAcc double
fuelRatio double
return void
Example #1
0
        public void Update(Vector3 acc, Vector3 angVel, double timeDelta, double ventingAcc)
        {
            acceleration    = rotationFromPart * engine.transform.InverseTransformDirection(acc);
            acceleration.y += ventingAcc;

            if (engine.part.rb != null)
            {
                angularVelocity = engine.transform.InverseTransformDirection(engine.part.rb.angularVelocity);
            }
            else
            {
                angularVelocity = engine.transform.InverseTransformDirection(angVel);
            }

            if (HighLogic.LoadedSceneIsFlight && engine.EngineIgnited)
            {
                fuelRatio = 1d;
                int pCount = engine.propellants.Count;
                for (int i = pCount - 1; i >= 0; --i)
                {
                    Propellant p = engine.propellants[i];
                    fuelRatio = Math.Min(fuelRatio, p.totalResourceAvailable / p.totalResourceCapacity);
                }
                // do pressure-fed tests?
            }
            if (ullageEnabled && RFSettings.Instance.simulateUllage)
            {
                ullageSim.Update(acceleration, angularVelocity, timeDelta, ventingAcc, fuelRatio);
            }
        }
Example #2
0
        public void Update(Vector3 acc, Vector3 angVel, double timeDelta, double ventingAcc)
        {
            acceleration    = rotationFromPart * engine.transform.InverseTransformDirection(acc);
            acceleration.y += ventingAcc;

            if (engine.part.rb != null)
            {
                angularVelocity = engine.transform.InverseTransformDirection(engine.part.rb.angularVelocity);
            }
            else
            {
                angularVelocity = engine.transform.InverseTransformDirection(angVel);
            }

            fuelRatio = 1d;
            if (HighLogic.LoadedSceneIsFlight && engine.EngineIgnited)
            {
                int pCount = engine.propellants.Count;
                for (int i = pCount - 1; i >= 0; --i)
                {
                    Propellant p   = engine.propellants[i];
                    double     tmp = p.totalResourceAvailable / p.totalResourceCapacity;
                    if (!double.IsNaN(tmp)) // Ordinarily we'd set to 0 if capacity = 0, but if so engine will flame out, so we just toss the result.
                    {
                        fuelRatio = Math.Min(fuelRatio, tmp);
                    }
                }
                // do pressure-fed tests?
            }
            if (ullageEnabled && RFSettings.Instance.simulateUllage)
            {
                ullageSim.Update(acceleration, angularVelocity, timeDelta, ventingAcc, fuelRatio);
            }
        }
Example #3
0
        public void Update(Vector3 acc, Vector3 angVel, double timeDelta, double ventingAcc)
        {
            acceleration    = rotationFromPart * engine.transform.InverseTransformDirection(acc);
            acceleration.y += ventingAcc;

            if (engine.part.rb != null)
            {
                angularVelocity = engine.transform.InverseTransformDirection(engine.part.rb.angularVelocity);
            }
            else
            {
                angularVelocity = engine.transform.InverseTransformDirection(angVel);
            }

            double fuelRatio = 1d;

            if (HighLogic.LoadedSceneIsFlight)
            {
                int pCount = engine.propellants.Count;
                fuelRatio = 0d;
                for (int i = pCount - 1; i >= 0; --i)
                {
                    Propellant p = engine.propellants[i];
                    fuelRatio += p.totalResourceAvailable / p.totalResourceCapacity;
                }
                fuelRatio /= (double)pCount;
                // do pressure-fed tests?
            }
            if (ullageEnabled)
            {
                ullageSim.Update(acceleration, angularVelocity, timeDelta, ventingAcc, fuelRatio);
            }
        }