Spline Container¶
A Spline Container holds one or more splines, which its inspector calls paths. Create one from GameObject > World Toolkit > Spline Container, which adds an object with a short two-knot spline, or add the component with Add Component > World Toolkit > Splines > Spline Container. You can also draw new ones directly while editing splines.
Drawing splines¶
While editing splines:
- With no knots selected, hold Shift and click away from other splines to place the first knot. If a Spline Container is selected and Append to Selected Container is on in the New Splines panel, the new spline is added to it. Otherwise a new Spline object is created.
- Click to add each knot. Click and drag to pull out the new knot's handles: it becomes a Bezier knot with Mirrored handles.
- Finish the spline in one of these ways:
- Right-click, or press Esc.
- Click the knot at the other end of the spline, usually the first one, to close it into a loop.
- Click the end knot of another open spline to join the new spline to it.
Double-click either end knot of an open spline to continue drawing from it: the new knots take that knot's type. Double-click a spline between two knots to insert a knot there.
Single-knot splines
If you right-click after placing just one knot of a new spline object, the object is removed again. Esc always keeps the knots you placed.
Where new knots land¶
With Stick to Surface on in the New Splines panel, new knots land on the collider under the cursor and are tilted to match it. With it off, or where there's no collider, they land on the ground plane, at height 0. The colliders of the Spline Container you're drawing into are skipped, so a road's knots don't land on its own mesh.
New knots also use the snapping options shared by all World Toolkit tools. Turn snapping on in the Snapping panel of the Scene view, or with Shift+V.
| Snapping | Where the new knot goes |
|---|---|
| Off | On the collider under the cursor (Stick to Surface) or on the ground plane. |
| On, over a snap target | On the target under the cursor, among the ones turned on in the Snapping panel: vertices, edges, face surfaces, spline knots, collider surfaces (Surface (Collider)) and so on. On a face or collider surface, the knot is also tilted to match it. |
| Grid | Away from targets, onto the grid (Grid Size). On a face or collider surface, the rounding happens along the surface, so the knot stays on it. |
| Increment | After the first knot, a whole number of Grid Size steps away from the previous knot, across the ground plane, or along the collider surface with Stick to Surface. It wins over Grid when both are on. |
The knot you're drawing from is never a snap target, so it can't swallow the next knot. Handles you pull out of a new knot snap the same way, and a highlight shows what the knot is snapping to.
New Splines panel¶
The New Splines panel in the Scene view sets up the splines you draw:
- New Spline Mode
- The type of the knots you click: Auto creates smooth curves with handles set automatically, Linear creates straight segments.
- Stick to Surface
- Places clicked knots, freeform strokes and shapes on the collider under the cursor instead of the ground plane. Shapes start on the collider, aligned with it, and the rest of the drag stays on that plane.
- Append to Selected Container
- Adds new splines, freeform strokes and shapes to the selected Spline Container instead of creating a new object.
Both are shared by every way of drawing splines, and are on by default.
Freeform drawing¶
Click Draw Freeform Spline, then hold the mouse button and drag in the Scene view to draw a spline like a pencil stroke. The stroke is turned into a smooth curve of Auto knots. The tool stays on so you can draw more strokes: click Exit Freeform Spline or press Esc to stop.
| Setting | What it does |
|---|---|
| Minimum Sample Distance | How far apart the captured points of the stroke are. |
| Simplification Tolerance | How much the stroke is simplified. Higher values give fewer knots. |
| Close Distance | If the stroke ends this close to where it started, the spline is closed. |
Shapes¶
Click a shape button, then drag in the Scene view to draw the whole shape in one go. The shape tool stays on so you can draw several: click its button again, or press Esc, to stop. Esc during a drag only cancels that shape.
- Circle
- Drag corner to corner. Hold Ctrl for a perfect circle.
- Rectangle
- Drag corner to corner. Hold Ctrl for a square.
- Polygon
- Drag from the center to set the radius and rotation. Sides sets the number of sides, or the number of points for a star. Inset pulls every other knot toward the center to make a star, and Spike Size rounds the outer points.
- Spiral
- Drag from the center to set the outer radius and rotation. Turns sets the number of revolutions. Inner Radius is where the spiral starts, as a fraction of the dragged radius: 0 starts at the center, 1 keeps the radius constant. Height lifts the end of the spiral off the surface, so a constant radius with a height makes a spring; a negative height coils downwards. Radius Bias and Height Bias pack the turns toward the start (negative) or the end (positive) of the radius and of the height.
Importing SVG files¶
Click Import SVG… in the
Splines section of the Edit tab of the
More module and pick an .svg file: every path and shape in it becomes a spline. Draw a road network, a coastline or a set of building outlines in a vector editor such as Inkscape or Illustrator, then bring it in as splines to build on.
- A new object named after the file holds the import. Each group or layer of the file becomes an empty child object, nested as in the file, and each path or shape becomes a Spline Container inside its group.
- Every object takes the name of its element in the file: the Inkscape label, the Illustrator layer name, or the element's id. Elements without a name are named after their kind, like Path or Rect.
- Each separate part of a path becomes one path of its Spline Container. Closed parts become closed splines.
- Curves keep their Bézier handles. Knots without handles are Linear, knots whose handles line up are Mirrored (same length) or Continuous, and the rest are Broken.
- Paths, rectangles (rounded ones too), circles, ellipses, lines, polylines, polygons and
<use>copies are imported with all their transforms. Text, images, clipping paths, masks and definitions are skipped. Hidden layers come in as inactive objects. - Scale, next to the button, is the size in metres of one unit of the file: a pixel, or a millimetre in a document set up in millimetres. It starts at 1 and is kept between sessions.
- The center of the drawing's canvas lands on the Scene view pivot, on the ground plane at height 0 and seen from above. In an orthographic side view (Front, Left...) the drawing lands on the plane facing the view instead, as new splines do.
- Each Spline Container's pivot is at the center of its knots. Ctrl+Z removes the whole import.
Editing knots¶
- Click a knot or handle to select it. Hold Shift to add to the selection, Ctrl to remove from it.
- Drag across empty space to box-select knots, with the same modifiers.
- Ctrl+A selects every knot of the splines you already have knots on, or every visible knot when nothing is selected.
- The Scene view highlights the part of the spline each selected knot shapes: the line on both sides of the knot, fading out halfway to the next knots. Its color is the Knot Segment Highlight in the Spline Settings, green by default.
- Click a spline's line to select its object.
- Drag a selected knot or handle to move it. With snapping on, dragged knots snap too.
- Unity's Move, Rotate and Scale tools work on the selected knots. Rotating a single knot turns it in place, and several knots turn around their center.
- F frames the selected knots.
- Del or Backspace deletes the selected knots. Deleting the last knot of a spline removes the spline.
Selected Knots panel¶
The Selected Knots panel says how many knots are selected, on how many splines and containers, and edits them all at once:
- Closed
- Whether the selected knots' splines are closed loops.
- Position and Rotation
- The knots' position and rotation, relative to their Spline Container.
- Linear, Auto and Bezier
- The knot type, see the table below. With a single Bezier knot selected, the Bezier list picks how its handles behave.
- In and Out
- The length of the knot's two handles. Expand them to type each handle's position. Typing a handle value turns the knot into a Bezier knot with Broken handles, unless it is Mirrored.
| Type | Curve |
|---|---|
| Linear | Straight lines in and out of the knot, no handles. |
| Auto | Smooth, with handles set automatically. |
| Bezier | Handles you control. Choose how they behave: Mirrored (both sides equal), Broken (independent) or Continuous (aligned, but different lengths). |
Knot menu¶
Right-click with knots selected for more operations:
- Split
- Cuts an open spline in two at each selected knot; both new ends sit on that knot. On a closed spline, opens the loop at the knot. The two end knots of an open spline can't be split.
- Extract
- With two or more knots of the same spline selected, moves that stretch into a copy of the spline's object, named after it with Extracted added. The original keeps the rest, cut open where the stretch was.
- Join
- With two end knots selected, joins two open splines into one, or closes a spline when both ends are its own. The joined knot sits halfway between them.
- Link and Link to Selected Knot Link
- Make knots of different splines move together. See Link Groups.
- Circularize
- With three or more knots selected, moves them onto the circle that fits them best, around that circle's own center rather than the knots' midpoint, and turns their handles along it so the curve between selected neighbors is a circular arc. Three knots always sit on their circle, so only their handles change. The circle lies flat across the Spline Container's up (level with the ground, unless the container is rotated) and each knot keeps its height; knots standing in a line seen from above, such as a spline drawn on a wall, use the plane they lie in instead. Knots at different heights get handles that climb between them, so they make a smooth spiral, like a ramp winding up. Linear and Auto knots become Bezier knots with Continuous handles, as do Mirrored knots whose two arcs differ. Handles towards knots that aren't selected keep their length. Knots in a straight line can't be circularized.
- Drop to Ground (Alt+Shift+D)
- Moves the selected knots onto the ground below them: any collider or terrain. Knots buried under the ground move up onto it. The spline's own object is ignored, so a road doesn't land on its own mesh.
- Center Pivot on Selection
- Moves the container's pivot to the center of the selected knots, without moving the spline.
Paths and path data¶
The inspector lists the container's splines under Paths. Add Spline Path adds a new short two-knot spline. Each path has:
- Closed
- Whether the spline is a closed loop.
- Knots
- The knots, usually edited in the Scene view.
- Path Data
- Extra values stored along the spline, each with a Name that other tools look up. Add an entry and pick its type, for example Float Curve (a curve from the start of the spline, 0, to its end, 1) or Gradient (colors along it). A Point Anchor can read a Float Curve to scale its object.
- Override Debug Sampling and Debug Samples Per Segment
- Draw this spline smoother or coarser than the Samples Per Segment in the Spline Settings.
- Debug Thickness Data Name and Debug Color Data Name
- The name of a Float Curve that sets the drawn line's thickness along the spline, and of a Gradient that colors it.
Editing a Float Curve in the Scene view
Set a Float Curve's Show On Scene As to draw it along the spline while its object is selected and splines are shown. Sides Mirrored draws two lines, one on each side of the spline, half the value away from it, which suits widths. Sides draws one line offset to the right, negative values going left. Vertical Mirrored and Vertical do the same above and below the spline.
- Double-click a line to add a key, and double-click a key to delete it.
- Drag a key along the spline to move it, or across it to change its value.
- Right-click a key for Delete Key, Edit Key... and the curve's tangent options.
Settings¶
The Spline Settings, in the Settings tab of the More module, set how splines and knots are drawn and which containers you can edit.