Ejemplo n.º 1
0
        /// <summary>
        ///     Calculates the forces and torque on a vessel at a given condition at the CoM
        /// </summary>
        /// <param name="vessel">Vessel in question</param>
        /// <param name="aeroForce">Total aerodynamic force at CoM, in kN</param>
        /// <param name="aeroTorque">Total aerodynamic torque at CoM, in kN * m</param>
        /// <param name="velocityWorldVector">
        ///     Velocity vector in world space relative to the atmosphere for CURRENT vessel
        ///     orientation, m/s
        /// </param>
        /// <param name="altitude">Vessel altitude, in m</param>
        public static void CalculateVesselAeroForces(
            Vessel vessel,
            out Vector3 aeroForce,
            out Vector3 aeroTorque,
            Vector3 velocityWorldVector,
            double altitude
            )
        {
            aeroForce = aeroTorque = Vector3.zero;
            if (vessel == null)
            {
                FARLogger.Error("API Error: attempted to simulate aerodynamics of null vessel");
                return;
            }

            FARVesselAero vesselAero = vessel.GetComponent <FARVesselAero>();

            if (vesselAero == null)
            {
                FARLogger.Error($"API Error: vessel {vessel} does not have FARVesselAero aerocomponent for simulation");
                return;
            }

            vesselAero.SimulateAeroProperties(out aeroForce, out aeroTorque, velocityWorldVector, altitude);
        }
Ejemplo n.º 2
0
        private void InstanceCalcVesselAeroForces(Vessel vessel, out Vector3 aeroForce, out Vector3 aeroTorque, Vector3 velocityWorldVector, double altitude)
        {
            aeroForce = aeroTorque = Vector3.zero;
            if (vessel == null)
            {
                Debug.LogError("FAR API Error: attempted to simulate aerodynamics of null vessel");
                return;
            }

            FARVesselAero vesselAero = vessel.GetComponent <FARVesselAero>();

            if (vesselAero == null)
            {
                Debug.LogError("FAR API Error: vessel does not have FARVesselAero aerocomponent for simulation");
                return;
            }

            vesselAero.SimulateAeroProperties(out aeroForce, out aeroTorque, velocityWorldVector, altitude);
        }