Page 1 of 1

Flight Model

PostPosted: Thu Apr 26, 2012 11:37 am
by stormclouds
The flight model for this game is reasonably complete now, I'm happy to stick with what I have (with perhaps some fine tuning).

I did try applying the basic forces of lift, thrust, gravity & drag (see this ground school webpage for some excellent information), but in the end found it too complex for a simple 2D game.

So I scrapped the above, and started with a simple equation:

Code: Select all
Vector2 vector = new Vector2()
{
    X = (float)Math.Sin(Angle),
    Y = (float)Math.Cos(Angle)
};

return (Vector2.Normalize(vector) * Speed);


This gives me a movement vector, given the plan's angle & speed. Next, after adding code to reduce speed when flying up, gain speed when flying down, stalling, low speed flight and some ground handling, I got this:



Its a bit jerky, due to fraps (maybe I need a faster machine?) Anyway, the game is not jerky when playing.

By the way, my youtube channel is 2DFlightSim, I'll be adding more dev blog videos here soon.