Week 3: Iterations and Secondary Flight Controls
- Trevor Pierre
- Jun 9, 2022
- 3 min read
Last week I started the implementation of the basic flight control systems. This included the Ailerons, Elevators, and the Rudder. I was able to accomplish by the end of last week, but was super dissatisfied with it. The main reasons being that I really wanted to utilize Unreal's Physics system more, and I didn’t like how stiff the controls were.
Here is what the old version looked like:
So, I spent a large portion of this week recreating my Actor so that the mesh used the Physics system. At first I ran into a few issues with implementing this with my skeletal mesh, but after converting it to a static one I was able to start flying:
The one issue that I kept running into was how would I rotate the plane on its axes. I started by trying to do this via the Add Torque function that can be applied to a physics object in Unreal. This adds a rotation and magnitude in the form of a vector. The issue with this is that it would always add the given amount and there was no real way to stop it, unless I applied the exact force for the exact same amount of time. This seems like a lot more work than I really needed to do, and using Add Torque was leading to the same issue I was experiencing with my old plane:
I felt like I was making zero progress, so I decided to go back to something simple, rotating the plane’s pitch to get an angle of attack. I started by drawing more debug lines, mainly one to show the target angle of attack that I’m trying to reach at any given moment:

After doing even more research and finding out other people have had problems with this too, my best bet looked like it was going to be using RInterp to interpolate to the rotation I wanted for each axis. I tested this out with the Angle of Attack first, and after some troubleshooting, it seemed to work really well!!
After that I implemented it for both the Ailerons and the Rudder, and the output is a lot better in than the previous version in my opinion:
I spent the rest of my time on the flaps and spoilers:

Flaps basically act as a way for a plane to generate more lift with less speed by increasing the surface area of the wings. This was overall pretty easy to implement and worked almost perfectly from the start:
All I had to do was have the surface area lerp between the min and the max surface area, depending on how much the flaps were extended:

Spoilers on the other hand allow for the plane to slow by reducing the lift of the plane. To accomplish this, I added a spoiler multiplier to my final lift calculation:

Overall, I’m very happy with how the revised plane feels and functions, and since it’s at a really good spot now, I plan to spend the rest of this week converting all of my Blueprints work to C++.
Welp, that’s all for this week's update! Even though I spent a lot of this past week on reworking the main plane, I feel like it was well worth the time and that I gained a lot by doing it. Next week I’ll start the Terrain Awareness and Warning System as well as gathering the data that will be displayed on the UI.
Hozzászólások