private void UpdateUpstreamValuesFromWingModules(List <FARWingAerodynamicModel> wingModules, List <double> associatedInfluences, double directionalInfluence, double thisWingAoA) { for (int i = 0; i < wingModules.Count; i++) { FARWingAerodynamicModel wingModule = wingModules[i]; double wingInfluenceFactor = associatedInfluences[i] * directionalInfluence; double tmp = Vector3.Dot(wingModule.transform.forward, parentWingModule.transform.forward); effectiveUpstreamMAC += wingModule.GetMAC() * wingInfluenceFactor; effectiveUpstreamb_2 += wingModule.Getb_2() * wingInfluenceFactor; effectiveUpstreamArea += wingModule.S * wingInfluenceFactor; effectiveUpstreamLiftSlope += wingModule.GetLiftSlope() * wingInfluenceFactor; effectiveUpstreamStall += wingModule.GetStall() * wingInfluenceFactor; effectiveUpstreamCosSweepAngle += wingModule.GetCosSweepAngle() * wingInfluenceFactor; effectiveUpstreamAoAMax += wingModule.AoAmax * wingInfluenceFactor; effectiveUpstreamCd0 += wingModule.GetCd0() * wingInfluenceFactor; effectiveUpstreamInfluence += wingInfluenceFactor; double wAoA = wingModule.CalculateAoA(wingModule.GetVelocity()) * Math.Sign(tmp); tmp = (thisWingAoA - wAoA) * wingInfluenceFactor; //First, make sure that the AoA are wrt the same direction; then account for any strange angling of the part that shouldn't be there effectiveUpstreamAoA += tmp; } }