Simulating airplane gliding (2d)

J

juancarlos

Guest
We are designing a 2D flying game (side perspective) with rather realistic physics. Question: How can I make the airplane glide and fly like a real plane?

For example, how can I generate a lift force to make the plane float? It would be nice if the lift force depended on the speed of the plane. In other words: when the speed is lost, airplane starts falling. And when the plane has enough speed, it glides in the air. Or is there any way to get around this so that plane at least looks that it glides like a real plane?

Thank you already
 

Relic

Member
For problems that are to simulate real physics I google the real physics!
lift: https://www.grc.nasa.gov/www/k-12/airplane/lifteq.html
drag: https://www.grc.nasa.gov/www/k-12/airplane/falling.html

Great thing is you don't need to worry about the whole formula, just the bits that you want to simulate. Personally, I'd be taking that lift (and drag/air resistance) is proportional to velocity squared as the important bit. All the other values (density, wing area, etc.) can be combined into just one coefficient that makes your game feel good at the scale you are drawing to in the game room.

E.g.:

Code:
var lift_coefficient=0.02;
var drag_coefficient=0.5; //play with both numbers here

lift=lift_coefficient*speed*speed
drag=drag_coefficient*speed*speed
You could then also work out forces for thrust and weight too. If using a physics room, apply these forces and see what happens. If you want to program your own physics then you may want to work out the direction of lift, thrust and drag as it will depend on the facing/alignment of the plane. Lift is perpendicular to the wings, not always up. Even more consideration could be given to WHERE these forces act on the plane. A simple approach has all of these forces acting on the centre of the plane (the origin). If this is the case you can just work out the direction of the net force to determine any changes in speed. A more realistic approach may have the lift and weight off centre/not aligned - which introduces challenges in taking off and landing.

Way too much to keep rambling on here, but hopefully gives you an idea of how to approach the problem. I'm a Physics teacher so if you have a go and want any more advice feel free to pm me. I won't commit to writing your code of course - but happy to help with the Physics reasoning of your flight simulations.
 
N

NeZvers

Guest
I'm no physicist but same as trying my hand on car drifting I just winged it. I would suggest start with basic controls as there wasn't any force, then introduce stuff like gravity and momentum. Then add that glide force.
 
J

juancarlos

Guest
Thank you both for your answers! Glad to hear a comment from a fellow physics enthusiastic. We have just downloaded this software and will start working with it now on. I believe I now have a lot of useful hints for the future.

But I will return to this later as we get familiar with the basic stuff and software interface.
 
Top