Pretty cool! I'm always pleased to see tutorials that provide walkthroughs of how to do physical simulation using a computer.
I have a few questions/statements that may help you improve your site and simulation. (You should know that I have a Master's degree in aerospace engineering with a specialization in airplane aerodynamics and design,
![](smile.gif)
).
You define the lift coefficient as:
lift_coefficient = CLo + CLa*alpha + CLde*elevator
which is just a lift coefficient that varies linearly with angle of attack and elevator angle.
Question 1: Have you considered using a nonlinear lift curve, in order to allow for stall? (I suspect your F22 Raptor flight model might include a nonlinear lift model.)
Statement 2: You have equations for, but don't describe, the side force CY and side force stability derivatives CYb and CYdr.
Statement 3: Unfortunately, I found a fairly critical inaccuracy in your model for the drag.
You define the drag coefficient as:
drag_coefficient = CDo + CDa*alpha + CDde*elevator
This is not physically consistent with the way drag actually grows. Drag does *NOT* grow linearly with angle of attack, even for an ideal wing. The simplest approximation to the way drag grows is a parabola, with drag coefficient calculated as a function of lift coefficient not angle of attack. A MUCH better approximation for drag would then be:
drag_coefficient = CDo + K * lift_coefficient^2
This is called the "drag polar" equation. The nonlinearity is present because a component of drag is induced by lift. Here, K is the induced drag coefficient, which is approximately:
K ~ 1/(pi * AR * e)
where AR is the wing aspect ratio and e is the Oswald span efficiency factor (1.0 for an elliptically loaded wing, less then 1.0 for everything else, which is basically everything).
If you want to model a laminar flow wing then you have to do something more fancy, and define two drag polars, one representing a "bucket" of low drag when lift is low and another representing higher drag when lift is higher. (Airfoil designers often talk about these "drag buckets" for laminar wings. And they also talk about leading-edge "separation bubbles" which burst at the edge of the bucket when lift becomes large enough.)
That said, as long as angle of attack is *very* small (maybe less than 1 degree, which makes for boring flight) your linear model may work okay. And also, for a game that is not meant to be really a flight simulator, the linear drag model may be okay.
You may be interested in checking out the following classic book on linear flight dynamics:
"Dynamics of Flight : Stability and Control" by Bernard Etkin.
This book doesn't treat the nonlinear lift either, but it is a classic.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Edited by - grhodes_at_work on August 21, 2001 11:07:21 AM
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net