Airplane Spline Movement



Oh yeah! I'm one step closer to a full airport simulation. It might not look like much, but this is quite a big building block for what I have in mind for airside operations. Up until now, I've mainly been focusing on spawning passengers and making them move from gate to exit. But a whole area of awesomeness is calling me from beyond: airside! This is where the magic happens, and this is where I'm going to explore a bit more next.
Before tonight, the airplanes in my simulation spawned about 30 seconds before the actual inblock time, in world space about 50 meters before the place they had to stop. From there, I applied some simple linear interpolation (lerp) to make them move forward and stop where I wanted. To smooth out this animation, I used a curve, which gives you full control over the speed through different moments of your animation. This works perfectly and makes it look a lot fancier (no more airplanes popping out of nowhere), but ideally the airplanes should land on the runway and taxi to their gate (and back again). So I needed to learn this: full control over airplane movement.
The way this works in Unreal Engine (or at least one of the ways you can make this work) is by using a so called spline. This is basically a line of connected dots, and while you lay them out, it almost feels like you're building an invisible rollercoaster. Afterwards, you connect a static mesh (any model you like), and by connecting this model to the location and rotation of the spline, it knows exactly where it has to go. You make it move by calculating its position in every frame (tick), and you can smooth the start and finish out with another curve. Put this all together, and it looks a little bit like this:
Now, please don't be distracted by the jagged movement that you see in the corners every now and then. This is something you can fix easily by spending a little bit more care on your spline layout. But the awesome thing here is that I now have the potential to make airplanes land, taxi, and depart any way I like in my simulation. How cool is that!
Unfortunately, I have to call it a day again, but I really can't wait to take my simulations to the next level. One step at a time, but we're getting there for sure!