Rail

With Railcam2D's Rail components, you can create paths through a scene that the camera can move along. When the camera is connected to a Rail, the Intended Position will always be calculated as a point along the Rail's path.

GUI

See the Rail component's Inspector and Scene GUI: GUI

Variables

Documentation for the Rail component's public variables: Variables

Methods

Documentation for the Rail component's public methods: Methods

Features

Rails allow for better control of camera movement. This is achieved through several different built-in features.

Orientation

Rails are defined as Horizontal or Vertical. A Horizontal Rail will track the target's x-position, while a Vertical Rail will track the target's y-position.

Rail component Horizontal and Vertical Orientation

Transition Effects

In-built transition effects allow you to create meaningful changes to camera movement at specific points in a scene and give a professional feel to your gameplay.

Rail component Threshold Effects

Under The Hood

Rail components are very lightweight and can be used readily without having to consider the potential overhead of having multiple Rails in a scene.

A Rail component does not have an Update method and so lies dormant until the Core component needs to use it. When the camera is attached to a Rail, the Core sends a request to the Rail to calculate the Intended Position. The Rail handles these calculations and then returns a value back to the Core, which then applies any adjustments to that value as necessary (for example, smoothing).