Download

realistic flight physics function library, anyone interested?

Hello,

I’m working on aplugin that simulates airplane physics. I’m using it for my own flight sim, but if there’s enough interest I’d like to put it up on the marketplace as well.

It doesn’t require any special setting up of your model, just enable physics, add it as a child component, plug in appropriate numbers, and it will fly. This model is ideal for simpler things that still need to have some aerodynamic properties (missiles etc), but for most games it can be used as “main” model - even though it’s simplified, it’s more realistic than flight model of almost every game that’s not a dedicated flight simulator (and some that are…)

https://youtube.com/watch?v=nhfPownP7MA

https://www.youtube.com/watch?v=jF-RzGtbqC4

https://youtube.com/watch?v=ZiUyCK9HqDc

-and as a bonus i’ll also throw in a simple raycast landing gear simulation, sensor helper to feed data to your instruments, and stability augmentation system.

Example project showing how to use it will be of course included.

EDIT: test game here - https://forums.unrealengine.com/showthread.php?91716-realistic-flight-physics-function-library-anyone-interested&p=446541&viewfull=1#post446541

EDIT2: released on Gumroad, get it here: https://gumroad.com/l/Mqnn

Tutorial playlist: https://www.youtube.com/playlist?list=PLpdNKDbSpbwV4xJCTI-9l_SGJjedPvAp9

EDIT3: FS template test game (EFMSim) here - https://drive.google.com/open?id=0B20tIRBAcOlsYllnbnZONjhOYkE - now with VR support

Plugin now available on UE Marketplace: https://www.unrealengine.com/marketplace/easy-flight-model

This is fantastic and something I’d definitely be interested in :slight_smile:

“Full” model looks well done!
I’ve build something similar in 4.3 using blueprints and my concern is stability of the model at low fps. I was getting all kind of weird glitches, airplane starting to shake, magnitude of forces changing rapidly as delta time changes too much from frame to frame. Did you implemented some higher order integrator to avoid it?
I’m planning to move my code to C++ but nevertheless it might be not necessary as your model looks solid. I would definitely be a happy customer!
Couple of questions regarding the flight model:

  • physics forces are applied to root body or individual components of root body?
  • do you calculate pitching moment?
  • is it limited to slower than sound barrier model?
  • in one of your previous videos it looked like each airfoil is implemented as separate component, is it still the case or you expect each aircraft to have 2 wings, 2 ailerons, 1 rudder and etc. (like vehicle component does)?
  • I was building my model to get a bit of simulation of flying in other than earth atmosphere, so playing with density of air and Raynolds numbers is important. Are you using them as variable inputs or constants?

-higher order integrator: nope,not using anything like that. But from my testing it’s stable and changes in delta don’t have significant effect on behavior until you’re below ~15fps. Of course if you attached it to a propeller or something else where orientation rapidly changes from frame to frame like that, things will start breaking down.

-forces are applied to individual components, if your model has bones, it’s applied to bone the socket is attached to. (so yeah, if you set constraints right, you can have wing flex too :slight_smile: )

-pitching moment - at the moment no, but I might add it at some point. Currently cambered airfoils and resulting pitching moment can be approximated by splitting the foil chord-wise and simulating the halves individually.

-there’s a mach drag curve, supersonic flight is possible but simplified. No mach tuck or anything crazy like that.

-yeah, each airfoil is still a separate component. Any configuration is possible, the logic is the same regardless of where the segment is located.

-air density is a variable, but acts as a simple multiplier, effects of reynolds number are not simulated atm. Theoretically you could have two models, one for low rn and one for high rn, and “blend” between them based on speed (that’s how it’s done in X-Plane), but I haven’t done that myself.

Nice! Getting those extra features myself shouldn’t be too hard.
Are you planning on making C++ implementation? Cause it allows you to run all custom physics code in physx sub-stepping, making it more precise and stable and relatively fps independent.
Good luck with getting it to marketplace! (if you decide to publish it)

Well, I didn’t plan to convert it to C++, as i’m… not very good at it, and the performance is alright in blueprint (there are no heavy iterations or anything, heaviest bit is raycast for ground effect and that won’t be sped up much by C++). But running it in physics substep does sound very tempting.
So…I don’t know.

I would love this.

Looks great, I’d certainly play around with it. Is it a C++ Plugin or Blueprint?

I just started converting simple FM to C++, already getting some results.
Full FM is blueprint, dunno if i’ll be able to convert it since it’s hideously complex, but I’ll try.

Also, one question:
I’m thinking about making C++ parts a plugin, that way they should work in both C++ and blueprint projects. Is there any problem with this approach?

Here is what I would like to see from this -

  1. Multi-player support - Cooperative and Versus
  2. An Example Aircraft with weapons (Guns, Missiles, Bombs, etc. ) using both the simplified and physics based flight model.
  3. An Newtonian or non Atmospheric flight model for Space for example
  4. Lots of settings - So that we can make each flight model unique.
  1. Already there. If the object this is attached to is replicated, it will work in multiplayer, regardless of mode.
  2. No problem, I already have bombs with flight model in my game, i’ll add them to example aircraft too. Guns are not a part of flight model as such, but I can add them too.
  3. The influence of this model fades with decreasing air density, if you set it to 0 it’ll behave as if it was in space (although, at that point you don’t really need a flight model, unless you want to have “Star Wars physics”.)
  4. Lots of settings - i’m actually trying to reduce the number of parameters. What I have at the moment is probably completely incomprehensible for a normal person:
    settings.png

I like that you already included delta wing and ground effect. I would really love to play with this and see how it works.

What is Auto Drag?

Auto drag is one of things that will get removed. It was an illconceived attempt to replace drag curve with automatically calculated one.

Nice work, yes indeed, certainly interested.

Thank you!
I have just some curiosity questions and you seam to know airplane physics better than me. I see that you have a ticker for delta wing with delta sweep setting. What kind of correction you do for delta wing? I vaguely remember that it was effecting induced drag, but I thought that just turning airfoil itself is enough to get the same effect.
Someone told me that for delta-plan kind of craft (no stabilizer) it’s important to model pitching moment. But from what I understand that effects only airfoils with specific profile and as it name suggests adds pitching moment to airfoil itself, so I’m not sure how does it help to not have stabilizer and why it works only on delta-wing crafts.

Delta checkbox allows you to attach the airfoil “straight” (aligned with trailing edge), while still changing effective mach as if it was swept.

Induced drag decreases with increasing aspect ratio, so for deltas it’s of course quite high.
I’m using standard formula (lift^2) / (pi * aspect * efficiency) to calculate it. This breaks down in stall, so i’m still deciding whether to scrap it and just make it user controllable with a curve, or keep it because it still gives you right results in “normal” flight.
Third, least accurate but most user friendly option would be to just have a single drag curve, and a value how much it’s reduced when downwash is disrupted (ie ground effect).

Pitching moment depends on camber of the airfoil. Control surfaces, in addition to changing lift, also change camber and thus pitching moment. It’s not modeled yet, so tailless delta would be uncontrollable, but i’m working on it.
I already have it in simplified model, that one calculates everything at single point (center of mass), so there are no other ways to steer it anyway.

I’m interested as well. This is very cool :cool: I have a little flight sim in progress but I’m just running physics on the main fuselage. It’s ok but it would be so much more realistic with true flight dynamics. Looking forward to the progress.

Looks useful.

I like multitracing everything too.
Solved you the “looping” problem?

im interested already . great job