NWH Aerodynamics Documentation
Docs ยป NWH:Aerodynamics:Airfoils:Airfoil

Airfoil

Airfoil class in NWH Aerodynamics is responsible for making the aircraft interact with air. It is sliced into smaller sections (AirfoilSection) which are then individually simulated using principles of 2D airfoil simulation.

If making an open-world game with a large-scale map (> ~4000 units), the shifting origin is required (not only for this asset, but in general with game engines that use floating point precision). Explanation.

Geometry

  • Corners of this trapezoidal shape are marked A, B, C, and D - starting in the top left corner and going clockwise. Corners can be adjusted along the Y-plane of the Airfoil, meaning only the 2D X-Z position can be adjusted along the 2D plane it is represented by. A blue-red movement handle is used for this.
  • To adjust the general position/rotation of the Airfoil use the position and rotation handles.
  • Each Airfoil is sliced along the slicing planes (dashed red lines in the image below) by pressing Slice button in the inspector into AirfoilSections. Each section is then simulated separately during the play mode.

Shape

Airfoil uses its own geometry representation in a form of a 2D trapezoidal plane with relative position and rotation to the Transform it is attached to. The shape of the Airfoil plane is adjusted using A, B, C, and D handle. AD and BC lines are always kept in parallel to each other.

If the shape of the airfoil can not be achieved using a single Airfoil multiple Airfoils can be attached to the object. This can be useful in cases such as a single-piece wing model. Still, the best practice would be to have one object and one Airfoil per single flight surface.

Airfoil adjusted to the shape of a wing using A, B, C, and D handles.

Slicing Planes

  • Slicing planes are imaginary planes that slice the Airfoil into smaller sections. These are represented using dashed red line gizmos.
  • The position of each slice can be adjusted using the red position handle.
  • Slicing planes are generated automatically but their number can be changed by adjusting the Slice Count parameter and pressing Generate Slicing Planes afterward.
Same Airfoil from the previous image, but with slicing planes added. These are usually positioned uniformly along the width of the Airfoil, or to match the edges of the ControlSurfaces such as airfoils and elevators.

Sections

Once the slicing planes are set up pressing Slice button will generate AirfoilSections - sections of an Airfoil that each get simulated separately.

Airfoil from the image above after pressing Slice button. AirfoilSections are marked by green lines and named S[sectionNumber].

It is important that the orientation indicators of each AirfoilSection point in the correct direction. When flying level the blue indicator (forward) should point towards the incoming air, the red indicator (right) should be flush with the Airfoil and point towards the B-C line and the green (up) indicator should point up from the airfoil plane. If the green indicator is pointing the wrong way press the Flip button.

AirfoilSection orientation indicator.

Position and Rotation

To adjust the position and rotation of the Airfoil plane in the relation to the Transform it is attached to, position and rotation handles can be used. These are similar to the Transform handles but only affect the Airfoil position and rotation.

Airfoil position and rotation adjusted independently of the parent Transform using the Airfoil position and rotation handles.

Gizmos and Handles

These are the gizmos used to represent an Airfoil inside the Unity Editor:

  • A, B, C, D - corners of the Airfoil.
  • Green dashed lines - AirfoilSections.
  • S0, S1, S2, S3 - AirfoilSection names (section 1, section 2, etc.).
  • Blue, green, red lines - AirfoilSection orientation. Blue - forward, red - right, green - up. These correspond to the typical unity XYZ axis colors.
  • Red dashed lines - slicing points / planes. Can be adjusted using the red arrow handle.
  • Position and rotation handles - used to adjust position and rotation of the Airfoil relative to the Transform it is attached to.
  • Yellow Sphere - positioned at the root of the position handle it represents the current Airfoil position.
  • Purple Spheres - aerodynamic center of each AirfoilSection.
Airfoil with gizmos displayed. The airfoil A, B, C, and D corners were re-positioned without pressing Slice button so the gizmos are still displaying the outdated AirfoilSections (green).

Setup

  • As an example a primitive cube with a scale of [5, 0.1, 2] will be used to imitate a wing model:
Using a flattened cube as an example wing model.
  • Add Airfoil component to the wing. Airfoil will try to automatically match the dimensions and orientation of the wing model:
Example cube after adding Airfoil to it.
  • Airfoil automatically performs Orientate To Mesh, Fit To Mesh, Generate Slicing Planes and Slice steps when added. This process can be manually called by pressing the Auto button. In some cases a manual setup might be required (or wanted):
    • Press Reset button to reset the Airfoil to a 1×1 square shape (default).
    • Press Orientate To Mesh for the Airfoil to match the mesh orientation. If the mesh does not resemble a wing this step will most likely fail. In that case, adjust the position and rotation of the Airfoil relative to the Transform using the position and rotation handles.
    • Press Fit To Mesh. This will position corners of the Airfoil to match the shape of the mesh along the Airfoil plane. Adjust manually afterward if needed.
    • Press Generate Slicing Planes to (re)create slicing planes and adjust them if needed to match and control surfaces such as ailerons or flaps.
    • Press Slice to slice the Airfoil along slicing planes into AirfoilSections.
  • If all went well pressing Play will result in a functional Airfoil.
  • If the Airfoil is a part of an aircraft there is a large chance that a symmetrical Airfoil to this one exists on the other side of the aircraft. In that case, assign it (the other wing or the other horizontal stabilizer) to the Mirroring Target field and press Mirror. This will create a mirrored copy of the current Airfoil on the other GameObject.

Airfoil Profiles

NACA1411 AirfoilProfile inspector.



AirfoilProfile is a ScriptableObject that determines the behaviour of the Airfoil.

Fields

  • 2D Cross-section - an icon of the 2D cross-section of the airfoil. Note that the Y dimension is exaggerated to better show the shape of the airfoil.
  • Coefficients - Cl (coefficient of lift), Cd (coefficient of drag) and Cm (coefficient of moment) can be used to tune the base behavior of the AirfoilProfile. These fields affect all the Airfoils using this AirfoilProfile. For individual coefficient adjustment check the Airfoil inspector.
  • Curves - AnimationCurves representing the lift, drag and moment values along the Y axis against the angle of attack on the X axis. X axis should be in range of [-90, 90]. Usually parsed from the Polar String but can also be set manually.
  • Parsing - Converts polar data from 2D airfoil simulation software such as XFoil into curves. Header Lines determines the number of initial lines to ignore (11 for XFoil) and the index values determine which column is what. By default the first column determines the angle of attack, next column is coefficient of lift, etc. If the curves are set manually this section can be ignored.

Included Airfoil Profiles

Over 1000 common airfoils are included.

After importing only NACA airfoils will be present in the NWH > Aerodynamics > Scripts > Airfoil > AirfoilProfiles directory but by double clicking on AirfoilProfiles.unitypackage in NWH > Aerodynamics > Scripts > Airfoil the rest of the AirfoilProfiles will get imported.

2023/05/14 16:43
Previous Next

NWH Aerodynamics Documentation

Table of Contents

Table of Contents

  • Airfoil
      • Geometry
      • Shape
      • Slicing Planes
      • Sections
      • Position and Rotation
      • Gizmos and Handles
      • Setup
      • Airfoil Profiles
  • About
  • Import Guide
  • Airfoil
  • AircraftController
  • Environment
  • NWH Common Scripts
  • Demos
  • Upgrade Notes
  • Changelog
  • Support