Spline Editor

 Make Spline

Let's continue with what we've done in the previous page.

The spline is drawn in the scene as long as you have the GameObject with spline behaviour in selection. Developers could click the blue control points(abbr. CP) and drag them around to modify the spline.

One thing to note that, if you click another object in the scene, it will remove the SplineGO (Spline GameObject) from the selection, and stop editing the spline. This is troublesome as it's hard to not click on other objects.

To handle this, Spline editor will prevent deselecting current SplineGO by clicking on other object, if you've selected a control point. So if you need to select other objects when you're editing spline, you could click on hierarchy window to select other objects, or click "ESC" to deselect current control points.

Enough foreword, let's see how to manipulate the spline.

The image below shows the inspector GUI of Catmull-Rom Uniform Spline (the Catmull-Rom Centripetal spline's GUI is the same as this one). 


Basic control

The first line has three buttons,

  • Add Point: insert a new CP after current selected one; if current selected CP is the last one, will add the new CP along the tangent direction with average distance of segment. the selection will move to the newly created CP after this operation.
  • Del Point: delete current selected CP, move the selection to the next CP if possible;
  • Make Cycle/Break Cycle: use this option to control whether the spline should form a closed cycle;

The second line provides interface to select CP directly; the first CP has index of 0; Clicking arrow button to select the prev/next CP.

The third line is used to edit the position of selected CP;

The fourth line is to specify the "tilt" angle, which is used to tweak the "UP" direction around the CP; it makes spline to roll specified angle additively, which affects the existing "UP" direction; 

About UP direction of Spline

The spline inherently defines "FORWARD" with derivative, but it cannot defines "UP" by itself, it needs we impose some arbitrary rule to define "UP". However, in order to define the object movement with spline, "UP" is a must. (consider a jet flying straight forward and rolling, you cannot define it with spline without "UP" control)

Skele's spline editor provides two method to define "UP": "Y-up" & "Minimum";

"Y-up" could provide better control, as long as your spline doesn't have strict up/down segment; 

"Minimum" could ensure smooth "UP" direction change, but might be harder to manipulate than Y-up.