Act as a Principal Aerospace Dynamics and Flight Simulation ...
Prompt
Act as a Principal Aerospace Dynamics and Flight Simulation Engine Programmer in Roblox Luau. ### CRITICAL OUTPUT & FILE PACKAGING REQUIREMENT: - You must package your ENTIRE response inside a single, continuous, copyable code block representing a standalone `.txt` file. - The VERY FIRST LINE of your output must be the file header containing your model name: `Filename: [ModelName].txt` (Replace `[ModelName]` with your exact model identification and version, e.g., `GPT-6-Astra.txt`). - Inside this single file, you must include: 1. Complete Mathematical Derivation & Frame Conventions. 2. The 100% complete, fully implemented `FlightController.luau` ModuleScript (with strict typing `--!strict`, zero placeholders, zero `# TODO`). 3. A complete Client / Input Bootstrap Script. 4. Aerodynamic Tuning Guide & Telemetry Reference. - Do NOT output any conversational text, pleasantries, or preamble outside this single file block. --- ### CORE OBJECTIVE: Simulate a rigid-body propeller aircraft on a single root BasePart (Airframe) using pure aerodynamic physics and momentum principles in modern Roblox Luau (`--!strict`). DO NOT use Roblox constraints (BodyVelocity, LinearVelocity, AlignOrientation, BodyGyro are strictly FORBIDDEN). All aerodynamic forces (Lift, Drag, Induced Drag, Sideforce) and moments (Pitch, Roll, Yaw) must be derived from airspeed vectors and applied directly via `Airframe:ApplyImpulse` and `Airframe:ApplyAngularImpulse` in `RunService.PreSimulation`. --- ### MATHEMATICAL & PHYSICAL SPECIFICATIONS: 1. AIRSPEED VECTOR DECOMPOSITION & AERODYNAMIC ANGLES: - Calculate True Airspeed relative to wind/ambient velocity: $\vec{V}_{\text{rel}} = \vec{V}_{\text{airframe}} - \vec{V}_{\text{wind}}$. - Express $\vec{V}_{\text{rel}}$ in the aircraft's local Body Frame $(u, v, w)$ where: * $u$ = Forward (along LookVector) * $v$ = Lateral / Right (along RightVector) * $w$ = Downward (along -UpVector) - Dynamic pressure: $q = \frac{1}{2} \rho V^2$, where $\rho$ is air density (derived from ISA altitude lapse). - Angle of Attack: $\alpha = \arctan2(w, u)$. - Sideslip Angle: $\beta = \arcsin\left(\frac{v}{\max(V, \epsilon)}\right)$. 2. WING AERODYNAMICS WITH NON-LINEAR STALL MODEL: - Implement a realistic non-linear lift coefficient curve $C_L(\alpha)$ with stall hysteresis: * Linear regime ($|\alpha| \le \alpha_{\text{stall}}$): $C_L = C_{L0} + C_{L\alpha} \cdot \alpha$. * Post-stall regime ($|\alpha| > \alpha_{\text{stall}}$): sharp drop in $C_L$, transitioning into flat-plate crossflow drag. - Profile Drag & Induced Drag: $C_D = C_{D0} + \frac{C_L^2}{\pi \cdot \text{AR} \cdot e}$ (where $\text{AR}$ is Aspect Ratio and $e$ is Oswald efficiency factor). - Total Wing Lift: $L = q \cdot S \cdot C_L$ (acts perpendicular to the relative wind in the plane of symmetry). - Total Wing Drag: $D = q \cdot S \cdot C_D$ (acts antiparallel to the relative wind vector). 3. 3-AXIS CONTROL SURFACES & STABILITY DERIVATIVES: - Control surface inputs $[-1, 1]$: Pitch (Elevator $\delta_e$), Roll (Ailerons $\delta_a$), Yaw (Rudder $\delta_r$). - Aerodynamic restoring and damping moments: * Pitch Moment: $M = q \cdot S \cdot \bar{c} \cdot [C_{m0} + C_{m\alpha} \cdot \alpha + C_{mq} \cdot \frac{q_{\text{pitch}} \cdot \bar{c}}{2V} + C_{m\delta_e} \cdot \delta_e]$ * Roll Moment: $L_{\text{roll}} = q \cdot S \cdot b \cdot [C_{l\beta} \cdot \beta + C_{lp} \cdot \frac{p_{\text{roll}} \cdot b}{2V} + C_{l\delta_a} \cdot \delta_a]$ * Yaw Moment: $N = q \cdot S \cdot b \cdot [C_{n\beta} \cdot \beta + C_{nr} \cdot \frac{r_{\text{yaw}} \cdot b}{2V} + C_{n\delta_r} \cdot \delta_r]$ (Ensure static stability: $C_{m\alpha} < 0$ and weathercock stability: $C_{n\beta} > 0$). - Propwash Tail Authority: Model propeller induced slipstream velocity over control surfaces using momentum theory so the pilot retains elevator/rudder authority at zero forward airspeed on the runway ($V = 0$). 4. PROPULSION, PROPELLER TORQUE, GYRO PRECESSION & P-FACTOR: - Propeller thrust: $T = \text{Throttle} \cdot T_{\text{max}} \cdot \max(0, 1 - \frac{V}{V_{\text{max}}})$. - Engine Torque Reaction: Counter-roll torque applied to the airframe equal to $-P_{\text{engine}} / \omega_{\text{prop}}$. - Gyroscopic Precession: Angular momentum cross-coupling $-\vec{\omega} \times \vec{H}_{\text{prop}}$ where pitch rate induces yaw, and yaw rate induces pitch. - P-Factor (Asymmetric Blade Loading): Yaw moment induced when $\alpha > 0$ due to the descending blade biting deeper air. 5. IMPLEMENTATION SPECIFICATIONS: - Modern Luau with strict typing: `--!strict`. - Provide a fully documented, self-contained ModuleScript: `FlightController.new(airframe: BasePart, config: AircraftConfig)` with `Update(dt: number)`. - ZERO placeholders, NO `# TODO`, and NO ellipsis (`...`). - Singularity guards on all denominators when parked on runway ($V \to 0$). - Rigorous unit conversion from metric SI to Roblox impulses.
Response not available
Response not available