Physics in Infinite Flight

I was wondering like how do planes fly in Infinite Flight like do they fly using real life principles for exemple thanks to the airfoil, Bernouli law etc or is it just sample coding “if speed = X and user tilt his iPad go up” ?

3 Likes

Im sure its more comlplicated than that, im not a developer so ill let someone else explain.

1 Like

If its that, Im gonna start my own flight sim company!

jkjk

1 Like

I can’t speak for IF because I have no specific inside knowledge, but I did go through the entire process of coding a flight sim from the ground up (a lot of years ago and on the hardware of the day). So there is likely a fair degree of necessary overlap.

And that includes the 3D world database, the graphics system of how that gets displayed in your current view direction with proper visual perception (and “z buffering,” the order you draw objects, to get the best overlap possible), and all the physics for how you track the current aircraft physics state from moment to moment, which dictates how you move through that 3D world. And instrumentation to display the physics state as the pilot would see it. And then all the aircraft and scenery design tools. It’s crazy…definitely not a trivial exercise.

I don’t remember if I ever specifically thought about Bernoulli’s equation. But you end up using elements of various equations as rules in the algorithms, like square laws for the increase in drag etc.

I paid a lot of attention to the relation of lift to angle of attack; I was always obsessing about AoA.

You definitely have to mathematically completely describe variables of Newton’s laws of motion, and separately do it for linear as well and rotational motion:

linear: position, speed, acceleration, each in the x,y,z dimensions

rotationally: position (current angle of pitch, bank etc.), speed (how fast you pitch, bank etc.), acceleration (how fast each of the rotational angles change speed), around each of the x,y,z dimensions

But it’s even more complicated than the above. For example, sure you have changes in position, speed and acceleration of all of the above multitude of variables, and described by Newtonian laws (which is what Bernoulli actually is anyway)…

But you have to mathematically, as well as by feel, impose things like dampening. And have to be able to make adjustments to that on the fly as you are adjusting the physics feel as a “test pilot”.
For example, you can’t just have the pitch, yaw or bank description. How do you make each of those feel heavy or light, more stable or unstable (runaway motion and oscillations)? It all has to be dealt with.

So there is a lot of ad hoc tuning, on top of the basic physics description.

Bernoulli, Newton’s laws, Navier Stokes, are all really just Newton’s laws. Navier Stokes is a specific case of Newton’s laws, and Bernoulli is a special case of Navier Stokes.

This is a rough outline of how you inch your way to trying to capture the complex physics of the real world. At least how I experienced it.

9 Likes

If it would be that simple, then all planes would simply rotate the same way regardless of weight and speed (As it would probably need a reference on what speed it should be, instead of just X). I honestly don’t know the specific code but it should be along the lines of ‘If Speed < 150 then this (this=plane) AoA >0 = False’. Seems more complicated than it seems like it is since you are not an Infinite Flight developer. You need that speed and weight variable to have the plane act as it should, and not act like one of the ‘Worse Flight Simulators’ Swiss001 reviews, which is not what we are aiming for at all, Player’s perspective and most likely (If not, likely) Dev’s perspective too.

In all, it mostly uses some research of real life physics and @adit explained the physics part very well, but it is not only speed and weight, as it also takes variables from the plane (i.e Flaps, Spoilers) into effect. During take-off it should not be as simple as you mentioned and of course, there should be coding that takes the flaps into effect maybe such as ‘if Flaps.angle > 0, Speed < 130, then allow this.AoA = >0’ or something along the lines of that. I am learning coding in real life, but it might be different from the code IF uses, so what I am showing is just from my experience and what I learned.
There is also fuel physics, which is a different thing of course, but still part of the Simulator Physics.

Fuel contributes to weight, fuel burn also contributes to weight, so they also have to contribute to that to see how fast the aircraft should be for the player to tilt the device up as well. Especially if they are using any fuel burn control and they have to contribute to that too, such as the fact you should use Flaps 10 on a 747-8 for best fuel burn. They need to contribute the flaps part if you will pull up mid flight for a specific reason. They have to code if you are fast enough or slow enough to stall out or overspeed.

So to sum up this essay about the more code aspect of things, it is more harder than 'if speed = X and user tilt his iPad go up" and it would look more like ‘if speed > 140, AoA > 0 then allow airphysics.lift’
and although my example might be totally different from how Infinite Flight is (again, I am learning a different javaScript thing, not sure exactly) but it should be along the lines of what I explained, just more complex. If you take what @adit said and what I said and place them together, it might have some more info possibly and you can turn it into a 5 page essay for a technology class, perhaps.

Anyways, have a good day!
-@Generic_Flyer
IFC user who’s fingers are now tired of controlling a 747 bound for Seoul and typing this essay at the same time

6 Likes

Which is why I had a massively thick 767 flight manual and consultations with the pilot who provided it.

No comment.

(edit: I added comments below. I should just forbid myself from trying to answer questions in the middle of the night)

1 Like

Estimate on how thick?

Thanks a lot for this incredibly detailed explanation. Now I understand better.

1 Like

Thanks for your essay!
Your and adit’s answer were very clear and interesting. Thanks guys

1 Like

What else can we say ? Nothing

As was said by the others

There should be a single number returned from your device tilt that corresponds to your angle of deflection.

That angle needs to be translated by the flight model logic. For a given change in angle value of your device, it will be altered by:

1)pitch force (torque) on the aircraft becomes more or less depending on IAS
2)but trim modelling will affect how much aerodynamic torque will be adding to or subtracting from that
3)the net torque force that results will cause an angular acceleration in the pitch direction
4)the angular acceleration is an increase to an angular, or rotational speed
5)this rotation speed changes your actual pitch angle
6)how that motion of change in pitch angle attenuates or slows down, in other words, the stability of the movement, must somehow be part of the routine.
7)and as @Generic_Flyer mentioned, things like flaps, gear and spoiler affect the pitching torque and movement as well, so each of the position states needs to somehow be separately imposed.

So there is a lot of code intervention between your device tilt and the plane going up.

For example, note the list above is almost exclusively how you get the pitch rotation out of the control input - you still need the step of when the code starts the linear acceleration vertically that turns into positive VS, which is what increases the altitude variable.

About the width of an adult hand including thumb. But it was printed out and bound with metal ties.

3 Likes

I was thinking about your question again.

Basically: what coding of irl physical laws stands between tilting my device back and my aircraft taking off?

My two prior responses:
1)the big picture problem, roughly
2)multi-layered logical steps (hierarchy of connected variables?) between tilt back and take off.

A little bit more about the physics, which is in the title of your topic after all:

As Tom Hank’s astronaut character said in “Apollo 13” while coasting back from the moon: “Sir Isaac Newton is in the driver’s seat now.”

Between you tilting your iPad back and take off, Tom Hank’s statement has to be true in IF, as far as what needs to be coded.

You have to go straight to Newton’s equations of motion from the start.

In the end, it’s all Newton’s laws you have to code in some kind of interpretation.

How the Bernoulli or Navier Stokes equations as a branch off from Newton’s laws, as an explanation of lift gets involved or not, is an interesting puzzle in itself, as there are tons of websites and youtube channels arguing about if and how lift can even be explained!

Long after coding a working flight simulator, I was surprised by all this ongoing debate. It’s never ending.

Leaving generation of lift aside for the moment, all of the aircraft’s coded motions are definitely rooted in Newton’s laws of motion:

All of the rotational movement (bank, pitch and roll), and all of the linear movements (forward, left-right, altitude) have to follow Newton’s laws of motion.

Force = mass x acceleration (Newton’s 2nd law) has a rotational version that is used to describe how your aircraft rotates with pitch. And Newton’s laws of motion connect forces all the way through distance moved:

force–>how much acceleration–>change in speed–>distance moved (linear motion version)

In the case of tilting your iPad back for pitch, all of the above will be the rotational version of the equation:

torque–>angular acceleration–>angular speed–>angle of pitch moved (rotational version)

irl physics you have the above relationship for all rotations: pitch, bank and yaw. And your aircraft’s movement has to be described by the linear motion version above, in each of the 3 dimensions of space.

How the dynamics of lift gets inserted is interesting, because it connects the rotational motion relationships to the linear motion relationships:

Why I obsessed, and still obsess about AoA (angle of attack).

A lot of the “fighting” about lift might be, say, Bernoulli (the pressure drop over the wing) or is it Newton (air forced down pushes the plane up). Which is very interesting, I think. I even saw a professional flight school website that claimed you get the Bernoulli pressure drop, plus a bunch of downwash that helps with lift too!

Briefly, aside from the coding aspect, for an irl physics cohesive, yet abbreviated, explanation of lift, I believe you need both the pressure drop and air forced down explanation:

The full force of lift being fully accounted for by Newton’s 3rd law, is not negotiable. Any physicist will tell you. So that’s change in momentum of air downwards. It has to equal lift.

But what about the pressure drop? Newton’s 3rd law only tells you how you generate the force of lift, it doesn’t tell you how it gets applied to the wing.

The pressure differential (between top and bottom of the wing) is a direct consequence of the air forced down. And, it is the direct application of the force to the object forcing the air down - it is where and how it pushes the wing up.

So it’s not one or the other, it’s both: 1)how lift is produced and 2)how lift is applied to the wing.

Change in momentum of air forced down (Newton’s 3rd law) = Force of the pressure difference between bottom and top of wing.

Wait a second, you’re extracting air from the front upper surface of the wing to move downwards to satisfy Newton’s 3rd law, DOESN’T EXTRACING AIR FROM SOMEWHERE CREATE A PRESSURE DROP FROM WHERE IT’S EXRACTED? Enter Navier Stokes?:)

Anyway, lift is air being curved by a solid object moving through the air. The movement creates a pressure drop on one side that pushes the object.

AoA (from pitch direction of rotation) changes the curvature of the air. It’s one of the fundamental connections to irl physics that’s used to vary the lift force in coding the physics.

Wing camber is the baseline curvature of the air, and AoA is the adjustable additional curvature of the air.

It doesn’t violate Bernoulli, Bernoulli is always there (and is, in fact, Newton as well).

Somewhere in the above is what happens in the coding between tilting your iPad back and the aircraft leaving the ground.

5 Likes

Why go to school when we have @adit

3 Likes

My brain having a meltdown trying to read this at midnight….

2 Likes

Walking at sunrise I was thinking how from tilt to takeoff, I should have said something about Newton’s laws of motion have to definitely be in the coding to get any kind of sense of flight.

But lift maybe catalyzed a word explosion.

Have a good sleep!

i learn more from u than my physics teacher

1 Like

Thank you for the compliment!

1 Like

Aeronautical engineers rise up

1 Like

Go Embry-Riddle Aeronautical University!

A curious takeout in all the words above is:

(which equals lift of course)

I’ve never seen the above identity explicitly stated by anyone in all the sources of “lift finally explained” or any other presentation on the nature of lift on the websites, youtube channels or anywhere else.

Kind of a mystery why this most basic foundation doesn’t seem to appear in any analysis or attempt to clarify - that these two are equal.

1 Like

To be completely honest, the code that becomes the executable program, starts with the structure of the environment you are creating in order to represent a subset of the real world.

Physics is the backbone of the code.

The specific coding itself is not so difficult (debugging your logical errors is another story). I mean, it’s a language with rules, and you have reference material to help you “speak” the instructions with the proper syntax, until you learn it with enough fluency.

The real problem with the coding is the overall web of logic and how it fits into the entire system. And you have to think and design a lot in terms of modular tasks broken down into suitably sized chunks with a logical structure of parameters going to and being returned from each module. Simply, it’s necessary proper housekeeping.

So the structure of how the code is contained, is massively important to avoid a spiderweb of indecipherable complexity.

So, I am sorry, but I disagree with you dismissing what I wrote as not being coding related.

It would be more constructive, and palatable, if you would state your perspective from your experience without dismissing something with which you have no experience. A questioning tone always goes over well, when one is learning.

By the way, the sim I developed was all written in C, with some assembly language from when I was tinkering with getting the fastest primitive graphics “drawing” routines possible. But in the end I realized C was plenty fast.

The 3D graphics representation and animation is a massive additional kettle of fish, which I found to be very challenging, but of course is what gives you the sensation that the physics is describing.

2 Likes