What is a Spline and why would I use one?

“Splines are piecewise polynomials going through given data points and satisfying certain continuity conditions” or, put more simply, a Spline is a set of points used to show a curved line.

Splines are often used in game dev to allow objects or cameras to move along a smooth curved path either from A to B or in a loop. You’ll find many uses for Splines and I’d recommend that you find out about them even if you don’t bother with the low-end math

As of 2022.1, Unity has a Spline package that can be easily installed via the package manager.

I’ve done a quick video to explain the process of adding the Unity Spline package and setting up a path for an object and a camera to track the object. This can be found on YouTube here

A Quick summary is as follows: –

  • Add the Unity Spline package
    • Go to the Package Manager and search “Spline”. This will show the Unity spline package. Install it and you’re good to go.
  • Add a set of points that you’d like to use as a path for an object
    • Right click on a gameobject in the Hierarchy view
    • Select “Spline->Draw Splines Tool
  • Click the scene view to leave a set of points that are linked together to form a spline. Press ESC when you’ve finished plotting points
  • Attach an object to the spline
    • Add an object to your scene (in the demo, I used a sphere)
    • Add a “Spline Animate” component to the object
  • Drag the Spline you’ve created into the Spline Animate component. In the above example, you can see it listed as “Player Spline”
  • When you hit play, you’ll see the object animate along the path of the spline

It’s all a very simple process, but take a look at the video and you’ll see how it works.

YouTube Video Here


Discover more from

Subscribe to get the latest posts sent to your email.

Leave a comment

Trending