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.
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.Airfoil
use the position and rotation handles.Airfoil
is sliced along the slicing planes (dashed red lines in the image below) by pressing Slice button in the inspector into AirfoilSection
s. Each section is then simulated separately during the play mode.
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
into smaller sections. These are represented using dashed red line gizmos.Slice Count
parameter and pressing Generate Slicing Planes afterward.
Once the slicing planes are set up pressing Slice button will generate AirfoilSection
s - sections of an Airfoil
that each get simulated separately.
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.
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.
These are the gizmos used to represent an Airfoil inside the Unity Editor:
Airfoil
.AirfoilSection
s.AirfoilSection
names (section 1, section 2, etc.).AirfoilSection
orientation. Blue - forward, red - right, green - up. These correspond to the typical unity XYZ axis colors.Airfoil
relative to the Transform
it is attached to.Airfoil
position.AirfoilSection
.Airfoil
component to the wing. Airfoil
will try to automatically match the dimensions and orientation of the wing model:Airfoil
to a 1×1 square shape (default).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.Airfoil
to match the shape of the mesh along the Airfoil
plane. Adjust manually afterward if needed.Airfoil
along slicing planes into AirfoilSections
.Airfoil
.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
.AirfoilProfile
. These fields affect all the Airfoil
s using this AirfoilProfile
. For individual coefficient adjustment check the Airfoil
inspector.AnimationCurve
s 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.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.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.