How would I get started on making a realistic flight system

Hi all, I am currently facing an issue regarding scripting. As much as I love the cm32 basic gyro physics I feel it is time to replace it. And unfortunately I have no idea how to go go about doing so.

My main issue is replicating realistic flight factors. That might include:

  • Wing lift on a rotatable basis
  • Climb gradients
  • Thrust that acts like its real life counterpart

I suppose it be too much of a stretch to involve Bernoulli’s equation.

I have basic formulas which can replicate the response time of the aircraft fly-by-wire system as well as basic N1 calculations.

What I ask of you is where would I get started eg. video resources and such.

Thank you

5 Likes

@BanTech has made a real elaborate explanation on the factors of realistic flight system I suggest you take a look over it.

As for actually scripting it, I believe your best bet would be to first make it unrealistic but flying on the lift, drag, weight and thrust forces in the global x, y and z axis. Then use the calculations found to augment the direction and magnitude of these forces step by step.

2 Likes

Firstly I’m assuming we’re talking about aeroplanes. Also, I’d recommend you read BanTech’s explanation first as I am assuming some technical knowledge.

Here is how I would approach the problem:

You need to understand the basic forces and moments involved, how to model them, and how to integrate them into Roblox’s physics engine. These need to be calculated differently for every aircraft. For example, the thrust of two different types of engines may have to be calculated in very different ways.

The main forces are:

  • Lift: Proportional to v^2, ρ (air density), and lift coefficient (affected by shape, angle of attack, flaps, spoilers, and ailerons). More information on how to calculate the last two later. Lift acts perpendicular to the oncoming airflow (in other words, perpendicular to velocity). The most complicated part of this is figuring out where these forces act and how that changes with the angle of attack. This would be extremely complicated to model in detail in real-time so you’ll probably need to do your own research to approximate where the forces act and how they change depending on angle of attack for each type of aircraft.

  • Drag: Proportional to v^2, ρ, and drag coefficient. You can just apply this force at the centre of the model. This acts in the opposite direction of the aircraft’s velocity.

  • Weight: Proportional to mass and acceleration due to gravity (can be assumed a constant -9.8) and applied at the centre of gravity (which can be approximated to the centre of mass). There are a few ways to do this depending on how you choose to utilise Roblox’s physics engine. If you’re using VectorForces, it’s probably best to create an object with the equivalent mass of the aircraft. You can work out that equivalent mass in Roblox units using Newton’s second law (F = ma) and workspace.Gravity. Otherwise, you can use a vector force or a body velocity - though you need to be careful because this can cause some issues while in contact with the ground from my experience so you will need to take into account the opposite force applied by the ground.

  • Thrust: This will be a function of the throttle, time, velocity, and air density. While creating your model consider that the change in momentum of the air flowing through the engine will be the opposite of the change in momentum of the aircraft. Remember that engines are complex mechanical machines that need to “spool up”, which affects their thrust in a very non-linear way due to the many different relationships involved. Your best bet is removing all that unnecessary information and creating a simple function based on graphs that show real-world data. Your “N1 calculations” might be useful here. There is some good information on thrust here: General Thrust Equation.

You will also need to model the rudder, yaw damper and vertical stabiliser:
Some information on their functions and how they work:
This site has moved to a new URL.
flight controls - What is the "yaw damper"? - Aviation Stack Exchange

On the ground you also need to consider:

  • Rolling resistance
  • Friction - brakes
  • Steering (centripetal acceleration)

How to deal with turning
Option 1: Apply forces in different places using VectorForces and let Roblox deal with the moments for you
Option 2: Calculate the moments yourself and control the orientation of the aircraft using BodyMovers.

Option 1 is the easiest, but option 2 allows you to make approximations for forces and where they act while maintaining some control over the turning forces.

How to make basic models for the factors involved
Depending on how realistic you want your model to be, you could use polynomial regression to make functions that approximate variables such as lift coefficient and drag coefficient. One very useful tool for making basic models for these things is Polynomial Regression Data Fit. You can also ignore less significant factors such as changing air density or make them basic straight lines, depending on what your end goal is.

Lastly, these are just my ideas. I’ve never successfully done this myself so perhaps @Aeson_Industries, @sleitnick, @Widgeon or @LiftCoefficient could provide some insight.

8 Likes