Hello, I am making a plane system, how can I get the cross sectional area of flow?

https://web.mit.edu/16.00/www/aec/flight.html

I need this to follow the formula

The formula you just listed is mass flowrate in kg/s which is found by multiplying density in kg/m^3 by volume flow rate Q in m^3/s of the fluid.

Mass flowrate is conserved accross a streamline according to bernoulliâ€™s equation.

For a pipe you can easily find the volumetric flowrate as we can measure the area of the fluid which is constricted in the pipe with itâ€™s velocity.

For a planeâ€¦ Yeah letâ€™s not even get started with the assumptions being made here, using the bernoulliâ€™s equation will not get you why the plane lifts by itself.

A good explanation is in the scientific american article, there are way too many factors on why planes stay in the air.

TL;DR simulating aerodynamics is not worth the effort unless you want a real simulator in which you need more than just that formula.

Also donâ€™t trust youtube videos. They can get it wrong and use equal transit time theory.

Idk what you want though realism or playability. I suggest looking at other flight games and how the behavior movement of the plane changes with angle of attack and such instead of dynamically trying to calculate lift.

So, I shouldnâ€™t use bernoulliâ€™s equation to make a plane on Roblox?

I mean, I want something like flighline, only the physics â€śaerodinamicâ€ť

Nothing else, since I am creating a game that contains plane, not as principal haha.

Anywhere else really by itself, the article should explain why.

@BanTech any opinions as an aerospace engineering student?

I have tried tho, before, by using as â€śAngle Of Attackâ€ť

Orientation.X

and doing some stuff, but it never ended well.

Never could be smart enough to make a proper plane system

this was my attempt lol.

```
local AOT = -MainP.Orientation.X
local x = (Weight) * Speed.Velocity.Magnitude/(135 + AOT*3)
x=math.clamp(x,0,Weight + 10000)
MainP.Rotate.CFrame = CFrame.new(MainP.Position,Mouse.Hit.p)
MainP.Lift.Force = Vector3.new(0,x,0)
local y=MainP.CFrame.LookVector * Csp
Speed.Velocity =Vector3.new(y.X,0,y.Z)
```

Csp is speed basically

If you want the physics you can look at this really cool paper titled

Flight Models in Flight Games

How Ace Combat 4 and Sky Odyssey juggle playability

and realism

It explains a really simple model where a plane moves where it points

From this simple description, a simplistic flight model could be made, and it would be

similar to the flight models of most early simulators. Pressing â€śRightâ€ť or â€śLeftâ€ť would

cause the airplane to roll at a certain rate. Pushing â€śUpâ€ť or â€śDownâ€ť would cause the

plane to pitch down or up, at a certain rate. Two keys would be assigned to the rudder

pedals, and would turn the airplane sideways like a car, at a certain rate. The throttle

control would adjust the thrust, making the plane go faster or slower â€“ different throttle

settings correspond to different terminal speeds. The airplane always goes in the direction

its nose points.

However yeah the trick is when you want it to be realistic

Edit: way too long tldr consider the scenario for when this takes place:

Such a control system would not take long to learn, and would not be a challenge in

itself. However, it would not be realistic.

This is because an airplane does not always fly in the direction it points.

Yeah I recommend reading the full paper. The first step is to make it unrealistic but working. Then you add the if statements for the

# STALL WARNING

Scenario

Absolutely. There are some very complex codes out there to determine lift/drag and even the 2D ones are pretty complex.

Iâ€™d like to preface the below by saying this stuff can become very complicated, however there are simplifications that can be made. I will go into how detailed I personally would do it if I were making a realistic plane system, but even then I am making simplifications here.

Nobody but yourself can decide how realistic or not you want to be - the most simple is to assume constant rates of change, a constant air density, and therefore hard code in a single curve of lift and a single curve of drag.

Okay, so firstly youâ€™ll need some aerodynamics knowledge, which can be challenging. Iâ€™ll try to explain as best I can.

## Aerofoil definition

Think of an aerofoil as a cross section of a piece of wing. It has an angle of attack relative to the air itâ€™s travelling through, and generates lift and drag.

Weâ€™ll use these three physical definitions for the aerodynamics.

## Lift

Lift is dependent on the angle of attack of your wing. A higher angle of attack (nose pointing closer to the sky) the greater the lift:

Notice the label lift coefficient, C_L, instead of a force. Thatâ€™s because the curve is not dependent on the side of the aerofoil or the length of the wing - only the shape. When converting to lift, you then factor in the speed, surface area and air density.

Tools such as xfoil can do this for unit length 2D aerofoils, but I donâ€™t recommend attempting to implement that in Roblox and certainly not generating the values at runtime. The closest thing to realism youâ€™ll get is to generate angle-of-attack C_L curves for your wing at a set of Reynolds numbers giving you a matrix of Reynolds in one dimension, angle-of-attack in the other dimension and C_L as the output. At values between the curves you can interpolate by whichever method you wish to.

Reynolds number is a way of dimensionalising the non-dimensional C_L and C_D values for a given flow condition based on air density (decreases with altitude) and velocity relative to the air (airspeed). Hereâ€™s a great area for simplification, however if you include it with an air density calculation based on height above the baseplate, it will naturally provide a ceiling for your aircraft. Otherwise youâ€™ll have to limit altitude some other way.

## Drag

For drag, most models out there predict it poorly until you get into really high level turbulence models. If you did the same as we did for lift, for the best drag model you can get hold of, adding some estimate for the body too, then youâ€™ll now have two matrices for the aero force coefficients.

To use C_D to create a drag force, the drag equation is very similar to the lift equation, just swap any L for D.

There are some really complicated aerodynamics that go into drag that wonâ€™t be in 2D analysis, such as tip vortices at the ends of the wing (this is why some planes have winglets). Itâ€™s not worth trying to simulate these, but it may be a case of increasing your C_D slightly by an appropriate factor. Youâ€™d need to research that.

## Thrust

Donâ€™t get me started on jet engines, itâ€™s not worth it as those are an entire different kettle of fish. Iâ€™d just get some thrust curves from the internet for the closest engine possible to the one youâ€™re interested in.

I think personally Iâ€™d make most of my simplifications here. Youâ€™ll still want to make it diminish with altitude, but itâ€™s complex and nonlinear.

Next would be to actually implement these concepts. Youâ€™d use the speed and air density with the knowledge of your wingspan to calculate Reynolds number at a given condition, and use that with the current angle of attack to calculate specific drag and lift forces at a given condition in real-time from your curve matrices. If applying the forces globally youâ€™ll just need to resolve the lift, drag, weight and thrust forces in x, y and z.

## Stall warning

Stall occurs when your aerofoil can no longer generate lift due to flow separation. Itâ€™s the reason the C_L curves earlier drop off and stop altogether.

Many planes have rudimentary stall warnings, and you can research what goes into those. If youâ€™d like to create an accurate warning based on the system you create, then a stall is easy to predict when you are close to reaching the end of your lift coefficient curve at the current Reynolds number. If the curve gradient is decreasing, it would suggest youâ€™re past the maximum lift angle and about to stall. Where the graph stops entirely is a deep stall.

## Flaps and control surfaces

If your plane system intends to use flaps, and you want to be really realistic, youâ€™ll then need to generate matrices for lift and drag for each flap condition too, and pull from the correct set based on the current flap angle. Definitely limit the possible settings.

For control surfaces (ailerons, rudders, elevators) you can follow a similar approach, as these are essentially flaps on horizontal or vertical aerofoils, except now weâ€™re talking about stability and you need to factor in the effect of horizontal and vertical stabilisers, and how their angle of attack relative to the airflow will provide restorative moments and additional drag. They are usually symmetrical aerofoils but youâ€™ll still need all the matrices and following all of the above, except now your lift and drag are acting at an arm to the centre of mass and predominantly create significant moments and negligible vector forces.

You could create entire sets of matrices for the control surfaces and various deflections and interpolate between them.

This approach of turning everything into curves at given conditions and interpolating between the conditions is exactly the type of thing youâ€™ll find in flight simulators, engine models at manufacturers and companies like Airbus and Boeing, and generally is a good way of having really complicated behaviour readily available in real time.

How realistic your system is will be fully determined by how many things you choose to properly model and get data for, vs. how many things you make assumptions and simplifications for. The NASA website on aerodynamics can be a deep rabbit hole if you do want to learn more, and with some googling you can find some tools and possibly some already-generated data for common aerofoil shapes.

I think it would be a challenge for anyone to properly implement such a system, but not impossible. As mentioned by @dthecoolest, itâ€™s a question of realism vs playability. The more realistic you make it, the harder it is for a beginner to fly. Pilot school exists for a reason, and it takes time to appreciate how planes move and very rarely fly exactly in the direction they are pointing.

As mentioned at the start, this isnâ€™t an exhaustive list of all things affecting aircraft motion. This is just a summary of how I would go about making a plane system with my simplifications and assumptions in there.

Hmm, for this piece of code, My only advice, for now, is to not use Orientation because this property of a base part is **relative to the world** XYZ axis with some Euler Angle Trait-Bryan thing that makes my brain explode

And moreover, the angle of attack is not exactly relative to the world XYZ axis. Itâ€™s the angle of the wing relative to the direction of flight or what this diagram explainsâ€¦

dang thats a lot of anglesâ€¦moreover this diagram doesnâ€™t consider what the angle would be if the plane was rolling as well in the z-axis as the diagram is only 2 dimensionalâ€¦

But I believe you should be able to find it as well there are two vectors to calculate an angle, one based on the velocity of the flight **assuming** it is = opposite to the velocity of airflow and another vector which is relative to the wing aerofoil which you can arbitrarily set relative to the plane, that should be possible to work with.

So yeah make sure you know what angle you are dealing with or else you might just start working with magic code which is definitely not a fun experience.

Personal case example:

In my case, itâ€™s when I start combining all the CFrame operators in all the permutations and combinations and wondering why Iâ€™m not achieving the rotation and position I want for my inverse kinematics project when my angle I use to apply the rotation is wrong in the first place .