This project is a continuation of the différents physics controllers I made. The goal here was to have an “Arcady” airplane controller based on real physics. I didn’t go for a more realistic approach like I did on the other controllers because the gap between arcade and realistic physics on Airplane is huge. I didn’t find an “in-between approach”.
The project is still on Unity with C# and fully customizable (and easy) presets for different types of planes. I insist on the easy part because the model I was based on (from the book Physics for Game Developers 2nd edition by David M.Bourg) was using coefficient on each part of the plane like the wings, flaps, etc. It made the tuning of the model too difficult and sensitive.
To make an airplane fly you need 4 forces as shown on the image below.
The weight is the force exerted by the gravity and it’s already handled by Unity’s rigid bodies. So we have 3 forces left to calculate.
The thrust is exerted by the engine. It’s a pretty easy force to calculate, you just have to apply a force in the forward direction of the plane. To make it more realistic I implemented a throttle system that result in a percentage of the max Force (the max force is defined in the presets) that I will apply. This percentage is increased or decreased by user interaction.
I said that the weight was handled by Unity rigid bodies, but they can also handle the drag. The reason I didn’t tell it above is that I modify the drag value of the rigid body at run-time from the speed and the flaps states.
If you aren’t familiar with what flaps are, here is a picture of the different components of an aircraft
To make it simple flaps are a kind of brakes but in the air.
Now our last force the Lift. I will try to make it simple, the lift is a force which is the result of a difference of air pressure and air velocity between the top and the bottom of the wing as the image below explain.
But it’s not as simple as that. The lift force depends on the angle of attack (AoA). This angle is calculated from the forward vector of the plane and the velocity vector of the plane as shown below.
The result isn’t as realistic as I wanted at the beginning of the project, but airplane flight dynamics are way beyond my level of comprehension at this time, but I’m still pleased with the result which is fun to play with.
To continue this series of physics controller I will make a helicopter controller because of the continuity with the airplane physics.