public void Update(Mesh mesh) { Wing.UpdateSections(); Fuselage.UpdateSections(); HorizontalStabilizer.UpdateSections(); VerticalStabilizer.UpdateSections(); UnderCarriage.UpdateSections(); }
public LandingGearAlignmentStatus AlignLandingGear(Transform transform) { // Position of c_g from ground // TODO: Make the height of this dynamic var h_cg = -66.875f; var minStrokeStrutHeight = (Mathf.Pow(Constants.Metrics.VerticalLandingVelocity, 2) / (2 * Constants.g * 0.9f * 2.7f) * 25f); var minEngineClearance = (Wing.Engines.First().Diameter * 10f * 1.9f) + Wing.Engines.First().Root.y + (0.4f * Fuselage.Diameter) - 20f; var strutHeight = Mathf.Max(minStrokeStrutHeight, minEngineClearance); transform.Translate(new Vector3(0, strutHeight + 3f - transform.position.y)); UnderCarriage.StrutHeight = strutHeight; // Strut Length Calculator for (int i = 0; i < 10; i++) { var wingStart = Wing.GetXPosition(); var wingRoot = Wing.RootChord; var landingGearStart = CentreOfGravity.z + Mathf.Tan(15 * Mathf.Deg2Rad) * -h_cg; if (landingGearStart < wingStart + wingRoot) { UnderCarriage.RearGearPosition = -landingGearStart; } else { return(LandingGearAlignmentStatus.TipBackNotInRange); } this.CalculateCentreOfMass(); } float l_n = CentreOfGravity.z + UnderCarriage.NoseGearPosition.z; float l_m = -UnderCarriage.RearGearPosition - CentreOfGravity.z; var taildownAngle = Mathf.Atan(1f / Fuselage.Afterbody.AfterbodyLengthDiameterRatio) * Mathf.Rad2Deg; var tipbackAngle = Mathf.Atan(Mathf.Abs(l_m / h_cg)) * Mathf.Rad2Deg; if (tipbackAngle < taildownAngle) { return(LandingGearAlignmentStatus.TipBackSmallerThanTailDown); } UnderCarriage.StrutCount = 1; if (MaximumTakeoffWeight < 200000 * Constants.lb2kg) { UnderCarriage.WheelCount = 2; } else if (MaximumTakeoffWeight < 400000 * Constants.lb2kg) { UnderCarriage.WheelCount = 4; } else { UnderCarriage.WheelCount = 6; UnderCarriage.StrutCount = 2; } var delta = Mathf.Asin(h_cg / (l_n * Mathf.Tan(63f * Mathf.Deg2Rad))); var width = (l_n + l_m) * Mathf.Tan(delta); // TODO: cSet landing gear height UnderCarriage.Width = width; UnderCarriage.UpdateSections(); return(LandingGearAlignmentStatus.Success); }