The Railcam2DCore component is the heart of Railcam 2D. It is responsible for camera movement and connects all the other components in the Asset.
The Core provides all the functionality that you would expect from a camera plug-in, including target-following, position-offsetting and smooth movement.
The Core also features an Update method selector and the ability to bound the camera to the target position, thereby keeping the target on-screen.
Camera movement can be smoothed as much or as little as needed. Smoothing is set independently for each axis.
The camera can be bound to stay within a certain distance of the target position (Intended Position). This prevents the camera from falling too far behind when smoothed, or when the target is moving or falling quickly.
Under The Hood
The Core works by tracking the position of a target object in the scene. This is used to calculate the position the camera should be at on the next frame, known as the Intended Position.
If smoothing is applied to camera movement, the camera will move to a point between the Intended Position and its current position instead. The larger the smoothing value, the longer the camera takes to reach the Intended Position.
The location of the Intended Position is also affected if an offset is applied, or if the camera is currently on a Rail.