feat(flight): add aspect ratio lift and altitude-hold trim

- Derive lift slope and induced drag from each wing's aspect ratio, found by grouping connected wing blocks across short span gaps.
- Give stabilizers and vertical wings their own parasitic drag from the stabilizerDrag config.
- Replace designSpeed with a fixed lift constant and a liftScale multiplier.
- Make auto trim hold the altitude the craft has when the pilot releases pitch, using nested altitude, climb and attitude loops.
- Add /improvedaerodynamics (alias /aero) to list, read and set the main config values in game.
This commit is contained in:
richard committed 2026-10-28 22:06:50 +01:00
1 parent 4b7fb0e1e8
commit 599ecae21f
10 files changed
+329 -48

No files matched your search

@@ -72,20 +72,26 @@ public final class Config {
public static final ForgeConfigSpec.BooleanValue IMPROVED_FLIGHT_MODEL = BUILDER
.comment("Replace Warium's lift and damping with a model based on each surface's angle of attack:",
"lift grows with the square of airspeed, surfaces stall one by one when their angle of attack gets",
"lift grows with the square of airspeed, the air pressure at the altitude and the wing's shape (long narrow",
"wings lift better), surfaces stall one by one when their angle of attack gets",
"too high, and stalled surfaces stop damping rotation, which allows post-stall maneuvers with",
"thrust vectoring. Changes how craft fly")
.define("improvedFlightModel", false);
public static final ForgeConfigSpec.DoubleValue DESIGN_SPEED = BUILDER
.comment("Improved flight model: airspeed (blocks per second) at which a level wing makes the same lift as in Warium.",
"Slower flight needs a higher angle of attack, faster flight a lower one")
.defineInRange("designSpeed", 40.0D, 5.0D, 300.0D);
public static final ForgeConfigSpec.DoubleValue LIFT_SCALE = BUILDER
.comment("Improved flight model: multiplier for the lift of all surfaces (drag is unchanged). Raise it if a craft",
"cannot stay up at the speed it should fly at, lower it for craft that climb too easily")
.defineInRange("liftScale", 1.0D, 0.1D, 10.0D);
public static final ForgeConfigSpec.DoubleValue STALL_ANGLE_SCALE = BUILDER
.comment("Improved flight model: multiplier for the angle of attack at which surfaces stall")
.defineInRange("stallAngleScale", 1.0D, 0.5D, 2.0D);
public static final ForgeConfigSpec.DoubleValue STABILIZER_DRAG = BUILDER
.comment("Improved flight model: parasitic drag coefficient of stabilizers and vertical wings. They stabilize",
"with lift, so this only costs speed. Wings use Warium's 1.0, which also stands in for fuselage drag")
.defineInRange("stabilizerDrag", 0.2D, 0.0D, 2.0D);
public static final ForgeConfigSpec.DoubleValue TRIM_AUTHORITY = BUILDER
.comment("Auto trim: largest pitch input (fraction of full deflection) the trim may hold")
.defineInRange("trimAuthority", 0.5D, 0.0D, 1.0D);