Class ControlSurface
Base class for aircraft control surfaces that modify airfoil aerodynamic properties through deflection. Handles rotation animation, input processing, and integration with the airfoil system.
Inheritance
Namespace: NWH.Aerodynamics.AircraftController.ControlSurfaces
Assembly: NWH.Aerodynamics.dll
Syntax
[RequireComponent(typeof(Airfoil))]
public class ControlSurface : AircraftMonoBehaviour
Remarks
Control surfaces work by changing the effective camber and angle of attack of the attached airfoil, generating additional lift and drag forces. The deflection angle directly affects the airfoil's coefficient of lift curve, with positive deflections typically increasing lift generation.
The system supports two rotation methods: LocalAxis (around airfoil X-axis) for simple hinge-like movement, and LeadingEdge rotation around the airfoil's front edge for more realistic control surface mechanics. Surface effectiveness scales with airspeed and decreases at high angles due to flow separation.
Control authority is highest at moderate airspeeds and angles of attack. At very low speeds, control surfaces become ineffective, while at high speeds, excessive deflection can cause flow separation and loss of effectiveness. Typical control surface deflections range from 15-30°.
Fields
| Edit this page View Sourceangle
Current deflection angle from neutral position in degrees. Positive values typically generate upward forces, negative values downward forces.
Declaration
[Tooltip("Current ControlSurface angle from the resting position in [deg].")]
public float angle
Field Value
| Type | Description |
|---|---|
| float |
Remarks
The deflection angle directly affects the airfoil's effective camber and angle of attack. Most control surfaces operate effectively within ±25° deflection range.
angleSmoothing
Control surface actuation smoothing factor (0-1 range). Higher values provide smoother movement but slower response to input changes.
Declaration
[Range(0, 1)]
[Tooltip(" Smoothing intensity of the control surface angle. Higher value will result in slower\r\n but smoother ControlSurface actuation.")]
public float angleSmoothing
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Simulates hydraulic or servo actuation lag. Values around 0.1-0.3 provide realistic control surface movement. Set to 0 for instant response, 1 for maximum smoothing.
maxAngle
Maximum deflection angle in degrees (positive direction). Limits control authority to prevent stall or structural damage.
Declaration
[Range(0, 60)]
[Tooltip("Maximum (absolute) rotation angle of the control surface. Should be a positive number.")]
public float maxAngle
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Typical values: Ailerons 15-25°, Elevators 20-30°, Rudders 25-35°, Flaps 40-60°. Excessive deflection angles can cause flow separation and loss of effectiveness.
minAngle
Maximum deflection angle in degrees (negative direction). Should be positive value representing the negative limit magnitude.
Declaration
[Range(0, 60)]
[Tooltip("Minimum (absolute) rotation angle of the control surface. Should be a positive number.")]
public float minAngle
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Often symmetric with maxAngle for primary controls (ailerons, elevators). May differ for asymmetric surfaces like flaps or trim tabs.
reverseRotation
If true rotation angle will be reversed.
Declaration
[Tooltip("If true rotation angle will be reversed.")]
public bool reverseRotation
Field Value
| Type | Description |
|---|---|
| bool |
rotationType
Control surface transform rotation type. LocalAxis - rotates the surface around the Airfoil transform's X-axis. LeadingEdge -rotates the surface around the A-B edge of the Airfoil.
Declaration
[Tooltip(" Control surface transform rotation type.\r\n LocalAxis - rotates the surface around the Airfoil transform's X-axis.\r\n LeadingEdge -rotates the surface around the A-B edge of the Airfoil.")]
public ControlSurface.RotationType rotationType
Field Value
| Type | Description |
|---|---|
| ControlSurface.RotationType |
side
Side of the aircraft the ControlSurface is on.
Declaration
[Tooltip("Side of the aircraft the ControlSurface is on.")]
public ControlSurface.Side side
Field Value
| Type | Description |
|---|---|
| ControlSurface.Side |
targetAirfoil
Airfoil this ControlSurface is connected to.
Declaration
[Tooltip("Airfoil this ControlSurface is connected to.")]
public Airfoil targetAirfoil
Field Value
| Type | Description |
|---|---|
| Airfoil |
trimSpeed
Trim speed coefficient of ControlSurface.
Declaration
[Tooltip("Trim speed coefficient of ControlSurface.")]
public float trimSpeed
Field Value
| Type | Description |
|---|---|
| float |
Methods
| Edit this page View SourceApplyAngle(float, float)
Declaration
protected void ApplyAngle(float targetAngle, float trimInput = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| float | targetAngle | |
| float | trimInput |
Awake()
Declaration
public override void Awake()
Overrides
| Edit this page View SourceFixedUpdate()
Declaration
public virtual void FixedUpdate()
Reset()
Declaration
public virtual void Reset()