Class AircraftController
Primary controller for aircraft physics simulation, managing aerodynamic forces, flight dynamics, and aircraft systems including engines, control surfaces, and flight instruments.
Inherited Members
Namespace: NWH.Aerodynamics.AircraftController
Assembly: NWH.Aerodynamics.dll
Syntax
[DisallowMultipleComponent]
[Serializable]
[RequireComponent(typeof(VariableCenterOfMass))]
[RequireComponent(typeof(AircraftInputManager))]
[RequireComponent(typeof(Rigidbody))]
public class AircraftController : Vehicle
Remarks
The AircraftController provides comprehensive aircraft simulation with realistic aerodynamics based on airfoil theory and flight physics. It manages all aspects of aircraft behavior including lift generation, drag calculation, control surface effectiveness, and propulsion systems.
Key features include: - Realistic aerodynamic force calculation using airfoil sections and finite wing theory - Multiple control surface types: ailerons, elevators, rudders with proper effectiveness curves - Engine simulation supporting both piston and turbine engines with propeller/jet propulsion - Landing gear system with ground contact detection and gear retraction/extension - Flight instrument integration for airspeed, altitude, attitude, and navigation displays - Fuel system with multiple tanks and consumption modeling - Environmental effects including wind, atmosphere density variation with altitude
The aircraft uses a component-based architecture where aerodynamic surfaces, engines, and systems are modular components that can be configured independently. The center of mass automatically adjusts based on fuel consumption and payload changes to maintain realistic flight characteristics.
Requires proper setup of Rigidbody mass and inertia tensor for realistic flight behavior. Use the Aircraft Setup Wizard for automated configuration of common aircraft types.
Fields
| Edit this page View SourceDefaultResourcesPath
Path for the NWH Aerodynamics defaults. Relative to the Resources directory.
Declaration
public const string DefaultResourcesPath = "NWH Aerodynamics/Defaults/"
Field Value
| Type | Description |
|---|---|
| string |
OnCollision
Triggered on collision.
Declaration
[Tooltip("Triggered on collision.")]
public AircraftController.CollisionEvent OnCollision
Field Value
| Type | Description |
|---|---|
| AircraftController.CollisionEvent |
Properties
| Edit this page View SourceAirspeed
Current airspeed of the aircraft in meters per second (m/s). Represents the speed of the aircraft relative to the surrounding air mass.
Declaration
public float Airspeed { get; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
Airspeed differs from ground speed when wind is present. It's the critical parameter for aerodynamic calculations as lift and drag forces depend on airspeed, not ground speed.
Typical airspeeds: - Stall speed: 15-25 m/s (30-50 kts) for light aircraft - Cruise speed: 50-100 m/s (100-200 kts) for general aviation - Commercial aircraft: 125-250 m/s (250-500 kts)
AirspeedKTS
Airspeed in [KTS].
Declaration
public float AirspeedKTS { get; }
Property Value
| Type | Description |
|---|---|
| float |
AngleOfAttack
Current angle of attack in degrees - the angle between the aircraft's longitudinal axis and the relative airflow. Critical parameter for lift generation and stall behavior.
Declaration
public float AngleOfAttack { get; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
Angle of attack directly controls lift production. Higher angles generate more lift up to the stall point, beyond which lift decreases rapidly and drag increases significantly.
Typical ranges: - Normal flight: 2-8 degrees - Maximum lift: 12-16 degrees (varies by airfoil) - Stall angle: 16-20 degrees for most aircraft - Post-stall: Above stall angle, reduced lift and increased drag
Elevation
Aircraft elevation in [m]. If FloatingOrigin is present this value will differ from transform.position.y.
Declaration
public float Elevation { get; }
Property Value
| Type | Description |
|---|---|
| float |
ElevationFt
Aircraft elevation in [ft].
Declaration
public float ElevationFt { get; }
Property Value
| Type | Description |
|---|---|
| float |
GlideRatio
Glide ratio (ratio of vertical vs. horizontal speed).
Declaration
public float GlideRatio { get; }
Property Value
| Type | Description |
|---|---|
| float |
Heading
Compass heading in [deg].
Declaration
public float Heading { get; }
Property Value
| Type | Description |
|---|---|
| float |
LandingGearTouchingGround
True if any of the landing gear is touching ground.
Declaration
public bool LandingGearTouchingGround { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Pitch
Aircraft pitch in [deg].
Declaration
public float Pitch { get; }
Property Value
| Type | Description |
|---|---|
| float |
RateOfClimb
Rate of climb in [m/s].
Declaration
public float RateOfClimb { get; }
Property Value
| Type | Description |
|---|---|
| float |
RateOfClimbFtMin
Rate of climb in [ft/min]
Declaration
public float RateOfClimbFtMin { get; }
Property Value
| Type | Description |
|---|---|
| float |
Roll
Aircraft roll in [deg].
Declaration
public float Roll { get; }
Property Value
| Type | Description |
|---|---|
| float |
Yaw
Aircraft yaw in [deg].
Declaration
public float Yaw { get; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
| Edit this page View SourceFixedUpdate()
Declaration
public override void FixedUpdate()
Overrides
OnDrawGizmosSelected()
Declaration
public void OnDrawGizmosSelected()
Start()
Declaration
public void Start()
UpdateFlightData()
Updates Airspeed, RateOfClimb and other flight data.
Declaration
public void UpdateFlightData()