Announcement

Collapse
No announcement yet.

How to get jet plane banking to work correct??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to get jet plane banking to work correct??

    Hello ...i am creating a jet plane pawn for my game and i am able to piece together the pitch and roll of the plane on the Pitch axis"W&S" and Move right axis"A&D" key respectively...but i am unable to create the banking motion of the plane whenever i press the A or D key; the plane only just rolls...I have tried many things ..can someone help?

    #2
    Banking turn of airplane happens due to the lift difference on sides, created by changing angle of attack of control surfaces. When pilot wants to make a right turn, he sets angle of attack of right control surfaces to produce lift pointing down and left control surfaces to produce lift pointing up. This banks airplane to the right side and lift of the wings is now pulls airplane partially in a horizontal direction, which makes it turn.

    Now to implementation side, I don't know how complex you want it to make. In it's simplest form, you can have a lift force acting vertically up in the local space of airplane. Every time you calculate a lift force, you transform it from local space of airplane to world space. This way, when you roll airplane, your lift vector won't be pointing up in the world space anymore and will be pushing airplane to the side.
    Last edited by BoredEngineer; 02-04-2015, 11:07 AM.
    Youtube Channel

    Comment


      #3
      Thank you BoredEngineer

      Originally posted by BoredEngineer View Post
      Banking turn of airplane happens due to the lift difference on sides, created by changing angle of attack of control surfaces. When pilot wants to make a right turn, he sets angle of attack of right control surfaces to produce lift pointing down and left control surfaces to produce lift pointing up. This banks airplane to the right side and lift of the wings is now pulls airplane partially in a horizontal direction, which makes it turn.

      Now to implementation side, I don't know how complex you want it to make. In it's simplest form, you can have a lift force acting vertically up in the local space of airplane. Every time you calculate a lift force, you transform it from local space of airplane to world space. This way, when you roll airplane, your lift vector won't be pointing up in the world space anymore and will be pushing airplane to the side.
      I am very happy to know that people are actually interested in flying games in UE4.
      I knew how the lift on an aerofoil works in real world as I am an aeronautical engineering student...but I didn't know how to actually implement it in the computer world, your post cleared up my confusion little bit, i will look into the transformation of local space force into world space force...if you have any resource like websites or pictures of blueprint graph please do post here.
      I am making the game to encourage my fellow students to delve into programming and also to demonstrate the effects of working forces on the aircraft structures and to make it easy for people to understand...

      Comment


        #4
        You got here at the right time then! I was working on physics based plane prototype last summer, but hit the wall as there were no way to alter Center of Mass or even query where it's located from the Blueprints. That made it almost impossible to apply Pitching Moment and I was stuck with a configuration where you had to manually align all lifting surfaces with unknown and invisible center of mass. Since 4.6 we should be able to query for location of Center of Mass, which should make it much easier to build everything properly.
        I can share some of the development decisions that was made, maybe it would be helpful.
        - Everything is pretty much build around AddForce nodes. Gravity is added by UE4, Lift and Drag are calculate individually for each lifting/control surface, summed up and added as a single resulting force. Thrust is added as another AddForce.
        - Most of the calculations are done in local space of the plane and lifting surfaces. For example, get plane velocity vector, transform it into the local plane space, from there you can calculate local velocity on each lifting surface by taking into account angular velocity of the plane.
        - Be prepared for a lot of erratic behavior from physics, to minimize it you need to aggregate as much forces as possible into a single AddForce and AddTorque commands

        I can share some parts of my blueprints when I get back to my code.
        Youtube Channel

        Comment


          #5
          okay okay...i am using 4.2 but I will try to follow quickly...and catch up...

          Comment


            #6
            It seems to me that the FInterp node does a good job of smoothing the transformation but, it is not physically accurate as the result produced by it doesn't follow the "Law of inertia".

            Comment


              #7
              I seem to have made a basic error....i think i need to use a skeletal mesh for add force and add impulse...and the blueprint should be of character class .. am i right????

              Comment


                #8
                Well, not really. I had a small space ship prototype in UDK, which was build from a regular Actor with Skeletal Mesh as a component.
                For airplane, I think I've used Pawn so it can be possessed by a PlayerController or AIController. I would say that Pawn is a good starting point. Character has a lot of code related to animations, doing path-finding and etc. but it's very specific implementation that won't really get you much of the benefit in case of physics driven airplane.
                For airplane, both static mesh or skeletal mesh should work just fine. I've used static mesh for simplicity. But using skeletal mesh gives you a number of benefits such as using bones for utilitarian purposes, like defining points where you can mount rocket or instrumental pods, engines, maybe even control surfaces.
                For example, main body of the jet can be done as a single skeletal mesh. Then you could attach a static mesh canopy to one of the bones of the airplane body and animate it. At the same time you could detach it when catapult goes off. Or you could make a skeletal mesh which consist only of the rigid portion of fuselage and then attach wings, control surfaces, rocket pods and etc.
                The only problem I had so far with building a Pawn out of separate pieces is a collision and physics behavior of a complete body.
                So attaching a rocket to a socket on a wing which is attached to fuselage won't change a mass and bounding box of the root body, by default. Having collision on anything but root body, didn't worked out for me so far.
                Youtube Channel

                Comment


                  #9
                  I have found one video of jetplane in ue4 made by Ats Kurvet on youtube ....it looks really cool , and i was hoping to atleast make something like that and build upon it...the video is called U4FGT- Unreal Engine 4 flight game test. Check it out..

                  Comment


                    #10
                    and as always thanks for the info, if you have any tutorial links which may be helpful for me just post it

                    Comment


                      #11
                      I am now able to atleast use the force node to add force in the y axis while banking..i did it after modifying the give ufo blueprint only...some problems are there but i am trying to solve them.

                      Comment

                      Working...
                      X