void UpdateAerodynamics(ModularFI.ModularFlightIntegrator fi, Part part) { if (part.Modules.Contains <ModuleAeroSurface>() || (part.Modules.Contains("MissileLauncher") && part.vessel.rootPart == part)) //FIXME Proper model for airbrakes { fi.BaseFIUpdateAerodynamics(part); return; } else { Rigidbody rb = part.rb; if (rb) { part.dragVector = rb.velocity + Krakensbane.GetFrameVelocity() - FARWind.GetWind(FlightGlobals.currentMainBody, part, rb.position); part.dragVectorSqrMag = part.dragVector.sqrMagnitude; if (part.dragVectorSqrMag == 0f || part.ShieldedFromAirstream) { part.dragVectorMag = 0f; part.dragVectorDir = Vector3.zero; part.dragVectorDirLocal = Vector3.zero; part.dragScalar = 0f; } else { part.dragVectorMag = (float)Math.Sqrt(part.dragVectorSqrMag); part.dragVectorDir = part.dragVector / part.dragVectorMag; part.dragVectorDirLocal = -part.partTransform.InverseTransformDirection(part.dragVectorDir); CalculateLocalDynPresAndAngularDrag(fi, part); } if (!part.DragCubes.None) { part.DragCubes.SetDrag(part.dragVectorDirLocal, (float)fi.mach); } } } }
void UpdateAerodynamics(ModularFI.ModularFlightIntegrator fi, Part part) { if (part.dragModel != Part.DragModel.CYLINDRICAL || part.vessel.isEVA) //FIXME Proper model for airbrakes { fi.BaseFIUpdateAerodynamics(part); return; } else { Rigidbody rb = part.Rigidbody; if (rb) { part.dragVector = rb.velocity + Krakensbane.GetFrameVelocity(); part.dragVectorSqrMag = part.dragVector.sqrMagnitude; if (part.dragVectorSqrMag == 0f) { part.dragVectorMag = 0f; part.dragVectorDir = Vector3.zero; part.dragVectorDirLocal = Vector3.zero; part.dragScalar = 0f; } else { part.dragVectorMag = (float)Math.Sqrt(part.dragVectorSqrMag); part.dragVectorDir = part.dragVector / part.dragVectorMag; part.dragVectorDirLocal = -part.partTransform.InverseTransformDirection(part.dragVectorDir); part.dragScalar = 0f; } if (!part.DragCubes.None) { part.DragCubes.SetDrag(part.dragVectorDirLocal, (float)fi.mach); } } } }
void UpdateAerodynamics(ModularFI.ModularFlightIntegrator fi, Part part) { if (part.Modules.Contains("ModuleAeroSurface") || part.Modules.Contains("KerbalEVA")) //FIXME Proper model for airbrakes { fi.BaseFIUpdateAerodynamics(part); return; } else if (!part.DragCubes.None) { Rigidbody rb = part.Rigidbody; if (rb) { part.DragCubes.SetDrag(-part.partTransform.worldToLocalMatrix.MultiplyVector(rb.velocity + Krakensbane.GetFrameVelocityV3f()).normalized, (float)part.machNumber); } } }