Implementing Camera Splines (Part 1)

As part of my first project for Tails of Fury, I was tasked with creating a spline tool in isolation (separate from the main project) for use in the platformer camera mode: specifically, a camera system that follows along a series of nodes aligned to a rail that tracks player motion. Roman referred me to this tutorial by n3k, which turned out to be an immensely helpful guide.

Since it’s just an isolated test, I started out with a blank, simple plane and imported Ethan the standard Unity character model to be my player character stand-in. I added five nodes (an arbitrary number) to serve as my camera rail network.

The entire project only requires two scripts: one that controls the rail and its nodes, and one that controls camera movement along the rail (including directing it to look at the player object).

From there, I wrote some scripts to determine the position of the player in relation to each node, and the closest node position at any given player position. That way, as the player object moves between nodes, the camera always jumps to the closest node to the player. Naturally, this creates a herky jerky motion camera-jumping motion that needs to be smoothed out.

Luckily, there’s nothing that can’t be solved with some good old-fashioned Lerping.

[Here’s the final camera movement at work.]

The next step will be to integrate this camera control system with the main game, and see how well it works with Lucas’s new level design.

Yiyi Zhang

Apprentice rodent programmer & marketing

Want to keep updated on Tails of Fury development?