This week I implemented a Bézier spline path generation tool in Unity to use for track generation. With this tool the user can, in real time; enable or disable looping (when enabled the last point is aligned with the first), set the width of the generated path, set the number of segments generated both along the length of the path as well as across the width of the path, and change the type of each point.
The three types of points available are the standard ones you’d find in any vector graphics image editing software: Free, Aligned, and Mirrored.
The free point has no restrictions on it, which can result in sharp, abrupt changes in your path. The second type shown, the aligned point, restricts the two handles to have the exact opposite directions of each other, but allows different lengths, resulting in smoother corners but still some flexibility. The mirrored type is like the aligned, except for that it requires that the handles to have the same length. This results in the smoothest corners of all three options, but it can be too restrictive for certain situations.
The next steps will be aligning the direction of ships to the section of the track they are on and preventing them from falling off the edges.