-
You can control the rate at which you traverse the curve using the same method used here for Bezier curves. ios - How to achieve uniform speed of movement on a bezier curve? - Game Development Stack Exchange Using this, it follows that if you want to travel along the curve L units every second, then you can increment t by L*dt / ||dM/dt||. (Ensure L * dt is sufficiently small. dt is the time elapsed per heartbeat if you choose to use heartbeat.) This will allow you to set the current Speed of your airplane of which you can accelerate by changing L which represents speed. Overall, you have much more control over speed along the curve with this method and can worry less about the magnitude of the velocities at your control points. What matters more is control of the actual path-shape as rate of traversal is easily controlled.
-
Trying to find a spline which turns at a set maximum angular velocity (or in your case, trying to constrain the curvature by setting a max value for curvature) is not easy. However, it’s not really necessary for good control over the curvature. Using: https://www.cs.uky.edu/~cheng/PUBL/Paper-Geometric-Hermite.pdf. On page 287, multiply both of your velocities at the control points by the value, a*. Note that the sum of both x-coordinates (from both velocities) must be greater than 0 to avoid a* being negative and flipping the direction of your velocities.
What this does is minimise sharp turns (whilst also preventing some other unwanted byproducts of hermite splines) along the curve. More specifically, it minimises the integral of the squared second derivative over the interval to achieve this. From there, set the direction of the velocity vectors at your control points reasonably and it shouldn’t curve too much. The closer they are to having the same direction, the less curving is usually done allowing for decent control over the curvature.
-
If the path minimizes the distance travelled, it would quickly converge onto a straight line between the start and end point, curving very sharply near them to match the starting and ending velocity directions.
This would not look nice.
-
As for applying the appropriate CFrame, you should calculate both your position on the curve and the tangent at your position which will be it’s vector derivative at that point. From there, use CFrame.new(pos, pos + tangent)*CFrame.Angles(0, 0, k). You probably want your airplane to turn left/right with greater x-z curvature (ignoring y because plane shouldn’t turn left/right when going up/down). And so, you can scale k with that curvature to create the turn.
Problem is, the curvatures between different pieces of the entire spline aren’t continuous, (i.e. no C2 continuity) and so, the k value will jump between connecting curves causing the turns to suddenly “jump” rather than change smoothly. For this, two solutions are:
-
Use a quintic hermite spline to define the starting & finishing “acceleration” and set the starting acceleration on the next curve as the finishing acceleration on the previous. This ensures the second derivatives are continuous between curves allowing for smooth changes in curvature. https://www.rose-hulman.edu/~finn/CCLI/Notes/day09.pdf
However, you’ll have to re-derive the advantage gained from point 2’s paper for quintic hermite splines by following the paper and trying the similar methods that they used to derive it for cubic hermite splines.
-
Much easier and not too less-aesthetic. Just use the cubic hermite but (for each separate curve) from t = 0.25 to t = 0.75, use the curvature of the spline as the value for k, but from t = 0.75 to t = 0.25 on the next curve, lerp k from curve1’s curvature at t = 0.75 to curve2’s curvature at t = 0.25. Then, start setting k to curve2’s curvature again between t = 0.25 and 0.75 (on curve2 now), and repeat the process for further curves.