How to Make an Airplane in Unity

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 มิ.ย. 2024
  • Realistic airplane in Unity!
    Learn to make a physics-based airplane with control surfaces, thrust, and brakes!
    Based on Ivan Pensionerov’s aircraft physics system: • Realistic Aircraft Phy...
    Chat with us on Discord: / discord
    Links:
    Aircraft Physics System github.com/gasgiant/Aircraft-...
    Finished Code github.com/skiwee45/Airplane_...
    Mountain Asset assetstore.unity.com/packages...
    Runway Material Asset assetstore.unity.com/packages...
    Skybox Asset assetstore.unity.com/packages...
    Music:
    All credit goes to Antti Luode www.soundclick.com/artist/def...
    Timestamps:
    00:00 Intro and Demo
    00:52 Clone Aircraft Physics GitHub
    02:38 Explain Aircraft Physics
    08:57 Add Thrust Control
    13:21 Add Ground Brakes
    16:54 Add Flaps on the Wings
    29:09 Small Fixes and Cleanup
    34:31 Outro and Flying

ความคิดเห็น • 83

  • @JumpTrajectory
    @JumpTrajectory 3 ปีที่แล้ว +32

    Nice video! Some thoughts about the part with aspect ratio correction. The tag and hard coded aspect ratio for wings is quite an ugly hack, as I'm sure you are aware. On the other hand I understand, that you kind of had to do it this way to avoid significant rewrite.
    For my video I made a plane with the wings splitted in two parts and it flew fine. I'm curious what was the problem you've encountered?
    Dispite the lack of problems in my case I think I should make some changes to the system. I probably should make the aspect ratio an independent parameter from the surface size, so it doesn't affect surface area. It's kind of counterintuitive, so I've not thought about it before. But in the case of surfaces that are part of a bigger one it makes sense. I need to do some research and also ponder on how to make it not too wierd from a user perspective.
    Thanks for pointing it out! I'll make an update when I'm done with my exams.

    • @icepops4613
      @icepops4613  3 ปีที่แล้ว +4

      Yes the hard coded aspect ratio is quite ugly.
      I did some tests (just recording how long it too me to take off or reach a certain altitude) with the split and without. Without produces much more lift. Using the hack where the lift slope uses the combined aspect ratio produced the same result as a wing with no split.
      On another project, I had created a Cessna 172 with entirely realistic proportions, thrust, and weight, but I could not get it to match the takeoff speed a real Cessna 172 had. With the hack of using the combined aspect ratio for lift slope, I got very close to the actual takeoff speed and takeoff distances.
      As I did more research, I understood why lift slope was related to aspect ratio, which led me to the conclusion that because the aspect ratio of each part of the split wings was smaller than before, it was producing less lift because the lift slope was smaller.
      I thought about this for a while, but could not think of an easy way to implement a combined aspect ratio that was also elegant. The problem only really applies to the wings. Perhaps in another video I will try another method.
      Thanks for checking out my video!
      I wish you the best of luck in your exams.

    • @icepops4613
      @icepops4613  3 ปีที่แล้ว +3

      Another solution that I thought of was having a way to have one aerosurface have two control surfaces. Like the wings would have the flaps and the ailerons, which would fix the problem. But this would need a huge revision to the current system and may be unnecessarily complex. The main problem with this kind of rewrite is that it wouldn't work with the current method of calculating aerodynamic coefficients (If I understand correctly). Or with the AeroSurfaceConfig, make an enum that specifies control surface type (non-control surface, flap, aileron, elevator, rudder) and for the flaps and ailerons, have a way for the two configs to share a general wing aspect ratio that doesn't affect size. The second method is very similar to the one you thought of but maybe it means the system wouldn't need a separate controlSurface object anymore.

    • @JumpTrajectory
      @JumpTrajectory 3 ปีที่แล้ว +2

      @@icepops4613 Very intresting to hear about your experiments with realistic Cessna! Unfotunatelly, I haven't had time to do this kind of tests when I was making my video. Based on your results it's absolutely crucial to add the abilty for surfaces to share aspect ratio. The easiest way would be to have a check box to detatch area calculations from the aspect ratio in the AeroSurfaceConfig. I'm thinking about having span and chord as controllable values and two mods for aspect ratio automatic and manual. It would be a quick fix.
      Also I should probably add custom coefficients curves mode for surfaces. The Khan 2015 paper is nice and easy, but if someone wants to model real plane they may want to enter real data.

    • @icepops4613
      @icepops4613  3 ปีที่แล้ว +3

      @@JumpTrajectory In the custom mode would people have to use experimental data and plug it in for the curves?
      Is there a way to combine real data with the equations? Because as you stated in your video, it is hard to find data for every angle of the flap and things like that. I think it would be easier to find data for flapAngle = 0 and use the equations (based off of the data) to find the coefficients for different flap angles. This would produce pretty realistic results without having huge amounts of data, but I'm not sure how to change the equations to do so.

    • @badbeardbill9956
      @badbeardbill9956 ปีที่แล้ว

      Ok so, aerospace engineer here.
      If I’m understanding right you’re wondering about how the wing aspect ratio is counted?
      So essentially an airplane is treated as having only ONE wing, which essentially cuts right into the fuselage, and that counts both for area and aspect ratio.
      So basically ignore the existence of the fuselage and assume that the wing extends through it. Then you have one wing for the purpose of calculating aspect ratio. This then allows for calculating induced drag and potentially downwash angle which can be used for the interaction with the horizontal stabilizer.

  • @kaushaljha9606
    @kaushaljha9606 3 ปีที่แล้ว +2

    very informative, great job!

  • @jackrubiralta1925
    @jackrubiralta1925 2 ปีที่แล้ว +2

    How does this video only have 19,000 views?
    Its too good to only have that many views

  • @ChookyChuck
    @ChookyChuck ปีที่แล้ว +1

    Very Nice, I have background in writing software for military flight sims and aeronautical engineering. I am currently playing star citizen and I am frustrated by how Arcady the flight model is. I am probably in the minority for this but I keep thinking modelling the physics is probably not much harder than an ad hoc arcade flight model when you have fleet of ships. Good work Ice Pops and Jump Trajectory.

  • @jk2kii1
    @jk2kii1 3 ปีที่แล้ว +1

    thanks dude my son did a cool game with this video

  • @rizamifthahusyifaudin7234
    @rizamifthahusyifaudin7234 3 ปีที่แล้ว

    nice keep it up

    • @icepops4613
      @icepops4613  3 ปีที่แล้ว

      Thanks! I've took a brief break to learn Blender, but I'll be back with more content soon!

  • @bracesport
    @bracesport 2 ปีที่แล้ว

    awesome stuff - @27.57min you can see the animation overlaid in the game window - how do I enable that?

  • @fetusness
    @fetusness 3 ปีที่แล้ว +3

    Great video- thank you SO much! 1 question though- I'm a bit lost on why you went through so much trouble to implement the flaps. I'm a bit confused on their function. are these the flaps that would engage before landing? Or do they make the aircraft more responsive to any given input?
    Thanks,
    Adrian

    • @icepops4613
      @icepops4613  3 ปีที่แล้ว

      Hello Adrian, the author of the original airplane physics did not include flaps because he did it for the purpose of physics, on the other hand, I wanted to adapt it to be more like a flight simulator with realistic plane features not just realistic physics. And yes, the flaps are use on landing to slow the plane down and to add lift as the plane slows down. It can also be used on liftoff to add lift.

    • @fetusness
      @fetusness 3 ปีที่แล้ว

      @@icepops4613 wow that's very cool- I think I'll have to watch another time to understand fully, but thank you for the reply, it means a lot :)
      Cheers,
      Adrian

    • @phxJohn2010
      @phxJohn2010 3 ปีที่แล้ว

      No. What Ice Pops is describing in this video are not flaps, they are ailerons. On traditional aircart the aileron is toward the outer edge of the wing and controls roll only. The flap on by the fuselage and are deployed on landing to give the wing more surface area, which creates more lift. Those kind of flaps arent usually deployed on takeoff. For a game setting, unless you want to make a simulator the actual flaps arent needed and the "flaps"(ailerons) will be sufficient.

    • @torusx8564
      @torusx8564 2 ปีที่แล้ว

      @@icepops4613 You add flaps in your finished code repo? By the way we can normally code it by just increasins the lift while flaps are down it should work.

  • @lagilagimolaglag
    @lagilagimolaglag 3 ปีที่แล้ว

    thanks

  • @Deatheragenator
    @Deatheragenator 11 หลายเดือนก่อน

    I would love to see this converted to use Unity's new input system.

  • @druzhe9402
    @druzhe9402 3 ปีที่แล้ว +3

    wow, some time before i picked up THE SAME PLANE!

  • @HammyHavoc
    @HammyHavoc 3 ปีที่แล้ว +3

    What are some good tips to improve immersion/realism when flying? It can feel a little... flat, or like moving across a void.

    • @arsizhifenerprozhod
      @arsizhifenerprozhod 3 ปีที่แล้ว +2

      add some clouds, and maybe limit the flying height to avoid scape the stratosphere.

    • @thesysop4998
      @thesysop4998 2 ปีที่แล้ว

      You can create a gps/autopilot for it

  • @fortnitegiftcard8541
    @fortnitegiftcard8541 2 ปีที่แล้ว +7

    Can you please do a video on just setting up everything and where everything goes like the scripts for example because the project in the zip file did not work and I had to make my own project with nothing set up

    • @madlad357
      @madlad357 2 ปีที่แล้ว +1

      Me too

    • @thebadprogrammer7114
      @thebadprogrammer7114 2 ปีที่แล้ว +1

      Yeah I tried the project in the zip and it was not setup like in the video

  • @baseraindrop7569
    @baseraindrop7569 2 ปีที่แล้ว +6

    Please make a more in-depth tutorial on how to set everything up because nothing is where it should be in the scene and nothing is working

    • @madlad357
      @madlad357 2 ปีที่แล้ว +2

      Same

    • @barrybbenson2624
      @barrybbenson2624 2 ปีที่แล้ว +4

      The input does not work even when I’ve set it up so it would be good if he made a in depth tutorial in stead of editing code

  • @Wabbas_wk
    @Wabbas_wk 2 ปีที่แล้ว +1

    Cool tutorial also why have you stopped uploading videos

  • @Mr.Epsilion
    @Mr.Epsilion 3 ปีที่แล้ว +5

    Please make tutorial a submarine ship PLEASE DUDE 🙏🥺

  • @USNeworleans149
    @USNeworleans149 2 ปีที่แล้ว +1

    Imagine axgamesoft modelling seaplane in turboprop flight simulator

  • @be_calm2372
    @be_calm2372 ปีที่แล้ว

    My task is to recieve input from PLC and control the airplane rather then keyboard keys, is it possible? by modifiying this video code?

  • @walney2008
    @walney2008 ปีที่แล้ว

    hello, could you teach how to put the cessna172 instrument panel like the flyght simulator? and how to configure a new plane as a boing for example?

    • @ChookyChuck
      @ChookyChuck ปีที่แล้ว

      Here are my thoughts on the instrument panel. Most of the info in the instrument panel is either engine power stuff or derived from the physics state vectors. Also aircraft show indicated airspeed which is function of speed and the air density. if we don't model an atmosphere it is just speed in the angle of attack plane. an attitude indicator is aircraft orientation in relation the the horizon. All these will need to some unit conversions and require some coordinate transformations. There is also turn rate, side slip, vertical velocity. Some with more unity knowledge would know how to render these in unity I am no unity expert. The tick rate for the instruments does should be slow in comparison to force calculation and the rigid body movement calculation. These calculation will probably have some trig so updates somewhere between 5 times per second to 1 per second are sufficient and some the instruments lag in real airplanes. One could also make a HUD with a velocity vector and pitch ladder, altitude and airspeed. These would nice for testing.

  • @walney2008
    @walney2008 3 ปีที่แล้ว +2

    Hello, I loved your project, it will help me in my studies, today I play fsx steam edition and I loved the cessna 172, rs, let me ask, is there a way to generate maps, based on google maps, google earth, and join this project? if so, could you teach?

    • @icepops4613
      @icepops4613  3 ปีที่แล้ว

      On the asset store there is a tool called world composer that will generate height maps from bing maps. If you want to do it yourself you can search for tutorials on how to import nasa height maps and satellite imagery. If I have time in the future I may make a tutorial on it.

  • @cheyuanchang522
    @cheyuanchang522 2 ปีที่แล้ว +1

    How to control camera to fixed at horizontal

  • @TheImperiumOfHumanity
    @TheImperiumOfHumanity 3 ปีที่แล้ว

    hey so i just tried this but yet nothing worked i got 999 errors when i just did exactly what you did it got curopted?

  • @victorfiy9844
    @victorfiy9844 2 ปีที่แล้ว

    WHICH INPUT SYSTEM IT USES NEW OR OLD

  • @iamprofessionalprogrammer
    @iamprofessionalprogrammer 2 ปีที่แล้ว +1

    sir , i have a question please ... how i can increase or decrease velocity the airplan??? please help me?

    • @benmcgregor7543
      @benmcgregor7543 2 ปีที่แล้ว

      lmao, you cant, get over it

    • @MarcelNKemet
      @MarcelNKemet 2 ปีที่แล้ว +1

      You don't. You instead act upon the acceleration (trust) either by increasing it or by pressing the brakes (like you'd do in a car).

  • @sucukluomlet4665
    @sucukluomlet4665 2 ปีที่แล้ว +1

    My example scene not working can someone help?

  • @anastasiaconstantine6719
    @anastasiaconstantine6719 4 หลายเดือนก่อน

    Bro how did you design this?!?!?!?!?

  • @user-nf3pd4ho9b
    @user-nf3pd4ho9b ปีที่แล้ว

    ❤❤❤❤

  • @milchbrocken6650
    @milchbrocken6650 3 ปีที่แล้ว +1

    Would be nice if you help me. It's not working. Idk why but if I do this the plane is not going up and down

  • @vhaz7831
    @vhaz7831 2 ปีที่แล้ว

    shiiiiit ima be makin the next msfs

  • @walney2008
    @walney2008 3 ปีที่แล้ว

    what steps, if you want other planes like boeing? downloaded from the internet? have control for helicopter?

    • @icepops4613
      @icepops4613  3 ปีที่แล้ว

      I do not have a helicopter controller and it would be quite different from this controller if you were to make one considering lift comes from a propellor instead of wings. Also you can 3D model your own planes or get some models for free online.

  • @C-126
    @C-126 2 ปีที่แล้ว

    I downloaded and imported the assets.. but the airplane will not even fly or animate!

  • @advaithvarrier2K13
    @advaithvarrier2K13 หลายเดือนก่อน

    How to go to the Gizmos?

  • @advaithvarrier2K13
    @advaithvarrier2K13 หลายเดือนก่อน

    I am not able to get the Gizmos

  • @IIIQZAIII
    @IIIQZAIII 6 วันที่ผ่านมา

    How to make the COMPAS?

  • @Tps-hj2ul
    @Tps-hj2ul 3 ปีที่แล้ว

    I am not getting the option ''Get bash here'' is there any option to bring it?

    • @arsizhifenerprozhod
      @arsizhifenerprozhod 3 ปีที่แล้ว

      Man, this guy is using "git" to acces "github" codes.
      I'm going to make it fly in another way, not sure.

    • @Tps-hj2ul
      @Tps-hj2ul 2 ปีที่แล้ว

      @@arsizhifenerprozhod oh, now I understood, thx

    • @digital_gaming8568
      @digital_gaming8568 2 ปีที่แล้ว

      you have to download git bash

  • @misamisa5634
    @misamisa5634 ปีที่แล้ว

    The scripts are in which coding language?
    Is it c#?

  • @be_calm2372
    @be_calm2372 ปีที่แล้ว

    Cn someone tell me, how can i change the controls from WASD to some other button or some other input to control the airplane

    • @ChookyChuck
      @ChookyChuck ปีที่แล้ว +1

      If we used joysticks to control it we would probably want to add trim. this would either be changing the center position of the elevator flaps or rotating the entire elevator. The plane would be very hard to fly with a joystick with out at least vertical trim.

    • @be_calm2372
      @be_calm2372 ปีที่แล้ว

      @@ChookyChuck thanks! Actually commands will come from PLC ,I need to use serial communication to control it.

  • @devioxs5355
    @devioxs5355 2 ปีที่แล้ว

    Why are you not making new vids

  • @Slink_Alot
    @Slink_Alot 2 ปีที่แล้ว

    where do i get the plane from ?!?!?!?

    • @epicboi3213
      @epicboi3213 ปีที่แล้ว

      @Ollgam gametime I would like it please

  • @xlsfade927
    @xlsfade927 2 ปีที่แล้ว

    Can you add the flight script to any airplane?

    • @nekojin1164
      @nekojin1164 2 ปีที่แล้ว

      1-Did you do it ?
      2-ill try with a plane except i need t in parts :(

    • @xlsfade927
      @xlsfade927 2 ปีที่แล้ว

      @@nekojin1164 it was too much of a pain for me to setup i couldnt do it :(

    • @nekojin1164
      @nekojin1164 2 ปีที่แล้ว

      @@xlsfade927 oof , im struggling here to add a speedometer , i changed almost all controls keys and made the accelerator a hold not toggle , wby ? did you add smtg to the script ?

  • @kalpolproductions8558
    @kalpolproductions8558 2 ปีที่แล้ว

    Errors so many errors