In this post, I’ll discuss simple 3D aerodynamics which can be used in video games & simple simulations.
Forces on a Plane
There are four important forces acting on an airplane.
Weight
This acts on airplane’s center of gravity, downward towards the center of the earth. It is constantly acting on a body. So with time, it keeps adding. This is the main reason why all objects accelerate due to gravity & not just move downward with constant velocity in the absence of any other force.
In a video game implementation, you just add this force G = mass * gravity to your body continuously. Here gravity can be represented by vec3(0, -9.8, 0) in SI units.
Lift
When aircraft move, it gets resisted by the wind but also pushes some wind downward due to its shape. As a result, an aerodynamic force is generated. The part of this force which is generated as a result of pushing air downward generates an upward lift. This is due to Newton’s 3rd law of motion.
This lift increases with increasing values of density, wing area & velocity. However, its dependence on velocity is not linear. Also, there are many other factors contributing to the aerodynamic force & we cannot easily calculate all of them. They include angle of attack & other dependencies. So we introduce a variable called lift coefficient to incorporate all of them. We find lift coefficient experimentally usually.
Lift force L = Cl * A * .5 * r * v^2
Here, Cl is lift coefficient, A is wing area, r is the density of air, and v is the velocity magnitude.
In a simple 3D simulation, one can calculate the lift magnitude using the above equation & multiply it with airplane’s local up-axis to achieve the vector form to be added to forces.
Drag
Just like lift, the air resistance opposite to velocity generates drag force. Since it is a component of same aerodynamic force, it depends on same factors. The equation for drag force is:
Drag force L = Cd * A * .5 * r * v^2
Here, only drag coefficient is different & rest of the variables are same. The important thing to consider is to use approximately real values for drag and lift coefficients that you can find for some kinds of objects on internet. In many cases the ratio between lift to drag is often 10:1 (varies between 5:1 and 20:1; varies even more). Having real values of these coefficients will ensure that the magnitude of these forces remains in realistic bounds & the object does not significantly misbehave.
After you calculate the magnitude of drag force, just multiply it with normalized(-velocity) to apply it opposite to velocity.
Thrust
Finally, we need something to push the aircraft, to generate velocity. Since if velocity is zero, we have seen that lift & drag, both depending on velocity will be zero. So if thrust force is zero, only weight is left.
Thrust force in your simulation depends on your choice. Often, it is better to use real values of thrust for different kinds of airplanes or birds. It makes sure that our choice is consistent with real world approximately.
Yaw, Pitch & Roll
If more control on aircraft is required, we can add these properties either by applying torques around center of gravity of our object, or by simply applying rotations based on user input. It depends on how much arcade nature you want in your game.
More reading
The below reference from NASA Glenn Research Center gives more in-depth details. However, I have summarized it here. In future, I aim to work on aerodynamics more & improve this post. Also, I’m planning to demonstrate it better by creating a game.
Related posts
References
1. https://www1.grc.nasa.gov/beginners-guide-to-aeronautics/