Week 8: Density and Spinning
- Trevor Pierre
- Jul 12, 2022
- 2 min read
Last week I focused on finishing the implementation for Wind, Stalling, and, The Turn Coordinator. This week I worked on:
Variable Air Density
Spinning
UI Work
Bug Fixes
To start off, when I decided that I wanted to try to implement Variable Air Density, I thought it would be a relatively simple process. But after doing a large amount of research, it’s a lot more complicated than what I thought it was. Air Density is dependent on a number of location and altitude specific factors such as:
Humidity
Air Pressure
Dry Air
Water Vapor
Air Temperature
And has an effect on the amount of lift that a plane can generate as seen below:

Since this was quickly going beyond the complexity and time I wanted to put into this feature, I decided to look for some sort of standard values that I could work off of. I was able to find a website that’s used to calculate these values that references A Dry Air Density Table from The U.S. Standard Atmosphere, 1976 Report in the NASA Technical Report Server.

Using the data from this table, I normalized the Altitude into a range of 0 – 100, and then just lerped between the min and max values provided by the table. Below is an example of the new variable Air Density, it isn’t super visually obvious on the plane, but I’ve provided a temporary HUD Element for it.
The big thing for this week was the implementation of a Spin. A Spin is a type of stall that is created when the plane has one wing that is stalling more than the other. This causes the plane to yaw and roll more in one direction than other. This can commonly occur when a plane is skidding, so that’s the scenario that I based my spin on.

I also looked at some example videos of a spin occurring to get a good idea of what the end product should look like:
The first thing I worked on was getting the code itself to recognize when a skid is actually happening. Since I already implemented The Turn Coordinator, this was relatively easy to do. Below is a video of just debug messages printing to the screen when a skid happens.
Next was the very long process of finding the best way to replicate a spin when it comes to rotating the plane itself. I went through a number of iterations with this and here are some examples of a few different versions:
Directly Modifying Rotations:
Using AddTorque():
This isn’t 100% done and is something I plan to finish up next week, but I think modifying the Rotations is the best approach. I tried using AddTorque(), but as mentioned in previous posts, the continuous application really sucks. Directly modifying the rotations though can mess with the lift generation, and accidentally cause the plane to start flying upwards again.
The last thing I worked on was finishing up on the Wind UI Arrows and having the Flaps and Spoilers Current values display on the UI instead of the Debug line:
That’s all really for this update, going forward I’m not going to be adding anymore features. I really want to focus on finishing and polishing what I already have, and making sure it looks and works the best it can be!!
Comments