Simplified Flight Model

Here are a couple of programs that demonstrate a simplified vector-based flight model that takes into account the basic forces affecting flight - lift, drag, thrust and gravity.
Basic Demo
Flight Demo with Sopwith Pup
This is a work-in-process, so feedback is appreciated.


Looking really good! The controls felt a bit sensitive at first, but once you get used to things the planes fly great (I only used my laptop touch pad though)

I’d highly recommend creating a demo with terrain or floating objects so we can get a better sense of speed and how the plane handles :slight_smile:

1 Like

Yes, I definitely plan to create a little “sandbox” for the aircraft - someplace where you can land, take off, chase enemies, etc.
I’m glad the touchpad works. That is a control I hadn’t tried

Check out the new and improved version of the Sopwith Pup demo
Sopwith Pup
I modified the AC.rote.js library to include taildragger take-off routines and to better incorporate the effects of gravity while turning (previously, the aircraft was “floating up” in turns). I modified the demo program to include more landscape features.

What I’m missing is some kind of control state representation. I move the mouse, press buttons, but I have no idea how the aircraft is interpreting it. Because there is a delay between input and aircraft behavior - it’s hard to control.

I’m a complete 0 when it comes to flight-based simulations/games, so this comes from a noob in the field. Maybe for more experienced people there is no such issue.

For most of the game-related usecases, i think that “realistic” flight is not necessary, so a stable control state being the default would be an advantage.

Basiclly, if I let go of the controls - I would like for the aircraft to just fly in the straight line towards the center of the screen. Just my point of view

1 Like

What frame rate are you getting? I tried it on my ancient MS Surface yesterday and was getting only 20 fps, which made it almost unflyable - certainly not fun. If frame rate is a problem I can change the program to take differing frame rates into account. The simulation is currently set up for 60 fps, which is what I get on my PC.

But if you are getting a decent frame rate, your primary flight control is the mouse.

  • To take off - move the mouse wheel until the power setting is “1”. When the aircraft reaches flying speed (around 60 mph), move the mouse back gently. This will cause the aircraft to pitch up and leave the ground.
  • Move the mouse gently from side to side to make the aircraft bank (and turn) left or right.
  • Move the mouse forward to pitch down and backwards to pitch up.
    Once you get used to it, the mouse control works surprisingly well. But the required mouse movements are generally fairly small. Sometimes when you try and do a roll, you will accidentally push forward or back which will cause a weird maneuver.

There are keyboard alternatives:

  • The -/= keys control the throttle.
  • The up/down arrow keys control pitch.
  • The left/right arrow keys control bank.

Once you have gotten into pretty much straight and level flight, you can try a few things to show how the control system works.

  • Bank slightly to the left or right. You will notice that the plane starts turning. This is because some of the lift that you are using to stay in the air is being deflected to the side. If you pull back on the mouse by the right amount, you will stay level for the entire turn.
  • Pull back on the mouse. This will put you into a vertical loop. You can keep doing this for several repetitions if you like.
  • Try to fly through the hangars. I would suggest starting a long way back so you can line up. Make gentle banks to turn left or right. As you are diving down, you will have to push forward more because the increased airspeed creates more lift. (You can also reduce the thrust a bit, should cause the aircraft to pitch forward without increasing airspeed.)

Finally, if you hold down the left mouse button, you can move the mouse to pan around the aircraft.

I hope this helps. Let me know if it does not.

As you suggest, one of my primary goals is to make it “user friendly”.


1 Like

Hey Phil, thanks for the explanation.

I have a fairly good desktop PC, so framerate is not a problem. My mouse sensitivity is very high, so small movements of the mouse cover large distance of the cursor. That would explain the control feeling really bizarre.

From perspective of user-friendliness, i think having some kind of control target display would help. Like displaying a target cross in the middle of the screen, and change its rotation based on the target bank (roll), but do that immediately, and have some other indicator for pitch.

Perhaps have a model in place that translates roll to yaw, so that the aircraft would always stabilize the roll to 0 over-time. That way if you let go of the controls the aircraft would always right itself with respect to roll (bank). Flying upside down is a really weird experience unless you’re already used to it, it is quite disorienting.

1 Like

Yes, it turns out that the mouse sensitivity is really high. I doubt I move my mouse more than an inch in any direction during flight. I guess I have flown it so many times trying to work out the kinks that I have gotten used to it. (From what I have heard, the sidestick on the F-16 is equally sensitive - so it not totally unrealistic.)

Nevertheless, I will see if I can loosen the controls a bit - or at least add a slider so you can adjust to suit.

I had previously posted a mouse-targeting demo where you use the mouse to move a target to the place in the sky where you want to go and the plane tries to go there. It sounds like that is similar to what you are suggesting. It used a combination of pitch, roll and yaw (for small changes). However, I was not able to make it work perfectly, so I did not use it here.

Flying upside down is weird in real life too. It is best done where there is some positive g-force, as in a loop or barrel roll. (I have done both.) But simply flying upside down means that you are hanging upside down in your straps. Pilots generally don’t like that sensation.

That’s quite interesting. As I said, I have very little experience with flight, none in real life and very little in games and simulators. I have read a bit on the subject thought, and I’ve seen similar statements from other people on the subject of flight controls beyond that in a horizontal plane feel quite unnatural.

I think that given time, your neuroplasticity can kick in and let you adapt to flying upside down etc. But for a newbie “flying” a plane would feel nice only if it’s basically like driving a car.

I guess limiting roll might help, like having it on a “rubber band”, so you can only bank your craft so much and it would always right itself.

About the “target”, I think the key here is mental model, allowing the user to predict the result of their inputs. Maybe a ghost model of the craft being rendered on screen, but projected 1-2 seconds ahead in time. You could adjust inputs and see what would happen, basically.

It’s a fascinating duality, on one hand it’s awesome to see realistic flight controls, on the other hand - it feels like riding a unicycle while rubbing your belling and being slapped with a tuna, for an uninitiated that is.

1 Like

Here are some things I have learned over the years, from flying both real aircraft and simulations:

  • If you want to turn, bank first then pitch up (or down) to maintain the desired altitude. If you try both at the same time, you risk over-controlling. (I can see if there is some way to reduce “cross-feeding” - e.g. by increasing the movement required for pitch so that you can more easily bank without changing pitch.)
  • If you want to make a small lateral adjustment, bank slightly.
  • If you are trying to arrive at a point in space (like a gate), bank first, so that you will intercept the point when you pitch up.
  • Pitch down is rarely used. It is very uncomfortable since all the blood rushes to your head and you can’t pitch down as fast as you can pitch up. So rather than pitch down, pilots would prefer to make a 180 degrees bank and then pitch up.
  • Similarly, flying upside down is not something that pilots do for an extended period. It is generally something you do only when you are transitioning to something else: e.g., lining up your bank or getting ready to pitch up.

You are correct in wanting the aircraft to stabilize. Most aircraft are designed to be inherently stable in flight.

With regard to banking, most general aviation and commercial aircraft have some dihedral in their wings so that the bank will tend to return to vertical. Aerobatic and combat aircraft have little or no dihedral because they want to bank quickly. The Sopwith Pup appears to have had dihedral, so I can add that option.

Obtaining pitch stability is more difficult since there is no natural tendency for an aircraft to fly level. Here the trim control is the pilot’s friend (which the Sopwith Pup didn’t have). But the mouse control actually does a good job of acting as a trim control because you can set it to a position and leave it.


I never thought that pilots would prefer to bank in order to reduce altitude instead of pitching down due to comfort. Quite interesting. I think that in a simulation without this kind of physical feedback it will be the other way around, since your orientation will be more “natural” when pitching.

If you can have a model that levels the aircraft’s bank/roll to 0 over time, it would make the model easier to control for the inexperienced and still allow various maneuvers that an experienced user may wish to perform, with some resistance from the model.

You could make the model’s automatic bank adjustment relate to current state bank-altering inputs, so if the user is trying to bank - let them, if they are not - level out at some rate.

It could be a parameter, like “strength of roll-leveling assistance”. You could set that to some reasonable value for a newbie and let the user change it later on if they desire. Same can be done to pitch.

For the sake of lateral controls, it would result in user just banking, and the model leveling them out automatically, no need to really understand what just happened, it just feels like driving from perspective of controls when making small adjustments. You could even pitch up slightly when recovering from a bank to regain altitude, it would probably feel very “gamy” to a real pilot, but would feel quite nice to a newbie.

Depending on your goals, having some kind of control assistance like this could be optional, to accommodate both users experienced with “real” flight controls, and those who are not.

1 Like

I must have misspoke. You don’t bank to reduce altitude, although that will happen it you don’t increase lift enough to make up for the downward lift you are losing. Actually, on a precision approach, you use power to control altitude and pitch to control airspeed. But on a flight simulator, most people (including myself) don’t have patience for a 10 minute approach. Instead, we will wait until the last possible moment and then aim for the runway, cut power, drop flaps and gear and hope that everything works out.

Yes, I can easily model dihedral, which will tend to return the back to zero. In my demo, I tried to assist by making the horizon line clearly visible, so that you know what is level. Also, because of limitations in the program, your external view always has a level horizon.

1 Like

Here is an updated version of the Flight Demo with Sopwith Pup

This version includes:

  • Moving control surfaces (thanks to wassfila for showing me how to do this).
  • Enemy aircraft with Positional Audio.
  • Firing guns with (nonlethal) tracer bullets.

Changes to controls:

  • Mouse buttons now control yaw.
  • Hold shift key and move mouse to pan around aircraft

Future modifications:

  • Different input schemes
  • Dihedral to re-center bank

This demonstration program now includes just about “one of everything” to show what can be done while still keeping frame rate at 60fps.

Future versions could include:

  • A variable frame rate version.
  • A “no texture” version (for better frame rate)

I could improve the demo create by adding features like rolling hills and more gaming elements (which I may eventually do just for fun). But the purpose of this demo is mostly just to show what can you can do with the AC.rote.js program.

As always, feedback is appreciated.


A couple of small fixes:

  • The sun was too high.
  • The axle on my aircraft too high.

Hit reload on your browser to see changes.

great work… :grinning:

1 Like

Here is the latest version of the Flight Demo with Sopwith Pup

This includes several enhancements. The most interesting change is that we have added a “pitch” animation to the model so that you can change aircraft pitch independent of the flight path. This allows you to do things like “flare” to a landing.

This Flight Demo is intended to show how you can use our helper program ACflyt.js to create your own flight simulation.

We have now created a separate webpage which discusses ACflyt and the Demo programs. You can also download a zip file that includes that latest version of ACflyt.js and the Demo that you can try using it in your own project.