Self-Flying Plane

I’m making an open city game and I’d like to have a plane fly to an airport and land by itself. It would be too inefficient and time-consuming to use C-Frames so I thought I could maybe have parts for the plane to fly towards and if the part is named “Landing” or something like that it lands? Sort of like the Piggy build mode patrol parts. I would appreciate any help I can get :smiley:

1 Like

You can use object CFrames or coordinate CFrames, either one is fine. Here’s my suggestion, assuming that the flight pattern is pretty simple, and the plane isn’t touring around the city, at that point you’ll need a lot more blocks

[STARTING BLOCK] → [RUNWAY BLOCK] → [PEAK BLOCK] → [PEAK BLOCK] → [RUNWAY BLOCK] → [ENDING BLOCK]

Have the Starting Block tween from one block to another, with the Runway Block being where the plane takes off, the Peak Block being where it stops gaining more altitude, and the second RunwayBlock being where it lands. The Ending Block should slow it down to a stop. Experiment with Easing Styles to see what looks good.

If you want to get complex, then use Bezier curves, but it’s not really neccessary

2 Likes

I agree with @hpgames16.
Unfortunately I would not recommend using TweenService because there are no properties of a Model that you can write to to change the CFrame.
Instead you would want to use RunService.Stepped or RunService.PreSimulation animate the a CFrame and then use PivotTo on the Model of the plane as well as anything not contained within the Model.
To calculate the changing CFrame I suggest doing this:
PointACFrame:Lerp(PointBCFrame, TimeElapsed*Speed/Distance)

Now while Lerp will calculate a linear path from A to B, that isn’t so bad. If you want it to be more curvy, then you can simply add more points between A and B.

3 Likes

Baseplate.rbxl (2.2 MB)
Here’s an example.

1 Like

Wow! It works! Thanks so much! I’ll definitely credit you in the game when it’s done! All I need to do with the plane now is remodel it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.