Press and hold UP for engines (no animation) Use LEFT and RIGHT arrow keys to pitch the plane up and down. Press SPACE to show velocity (green), heading (blue), and acceleration (red). Don't worry, you can't hit the ground!
This was a fun project I made a while ago which demonstrates one way to calculate lift forces on an airplane. It's based on the "angle of attack" which is the angle between the heading and the velocity vectors. It can be calculated using the dot-product formula: angle of attack = arccos(H . V / |H| * |V|) where: H = the heading vector, V = the velocity vector, H . V = the dot product between H and V |H| * |V| = the length of H times the length of V The dot product between two vectors H and V ( where H = [Hx, Hy] and V = [Vx, Vy] ) can be calculated like so: H . V = Hx * Vx + Hy * Vy The magnitude of a vector V ( where V = [Vx, Vy] ) can be calculated like this: |V| = sqrt(Vx * Vx + Vy * Vy)