<aside> <img src="/icons/reorder_gray.svg" alt="/icons/reorder_gray.svg" width="40px" />

Navigation

</aside>

🏠 Home Page

Getting Started

Architecture

Level System

Characters & Vehicles

Run Mechanics

World Objects

Boosters & Modifiers

Progression & Economy

UI

Save & Debugging

Modules

Publishing

Reference

💰 Monetization (Ads & IAP)

<aside> 💡 The game uses Cinemachine virtual cameras. CameraController switches the live camera by changing the priority of the virtual camera that matches the current state.

</aside>

Subsystems

virtual-cameras.png

States

CameraController.SetState(CameraState) sets the priority of the matching camera to 10 and the others to 0. Cinemachine Brain blends between them.

State Camera Target When
Start StartVirtualCamera The character Start screen. A hero shot in front of the character, framed to the bounds of the character and the launcher.
Aim AimVirtualCamera The launcher Aim phase.
Run RunVirtualCamera PlayerController.CameraTarget The launched run. 3rd Person Follow.
UpgradeFocus UpgradeFocusVirtualCamera The launcher or the vehicle Zoom-in when an upgrade changes the visual. The distance is fitted to the bounds of the target.

API

Method Description
SetState(state) Switches the live camera. The Start state refits the shot on every entry, because the launcher and the vehicle model change between runs.
SetRunTarget(transform) Changes the follow target of the run camera. Used after a sled crash.
SetRunCamera(settings) Applies RunCameraSettings of the current Character.
FreezeRun() Clears the run targets. The camera holds its last pose. Used on a water splash and on the finish.
FocusOnUpgrade(target, padding) Frames the target and switches to UpgradeFocus.
GetVisualBounds(root) Mesh bounds of an object. Particles and line renderers are ignored.

Camera Blends

Assets/Project Files/Data/Camera Blends.asset is the custom blend list of the Cinemachine Brain. The switch from Run to Start is a cut, so the camera returns to the start behind the fade overlay.

Run camera target

PlayerController creates a yaw-only follow target. The target trails the heading instead of copying it, so the player sees a turn and the world does not swing around the vehicle.

Field Description
Camera Yaw Smooth Time Smoothing of the yaw.
Camera Yaw Dead Zone Heading error that is ignored.
Camera Yaw Soft Zone Heading error above which the camera follows fully.

A movement behavior can change the heading source with CameraHeadingFromVelocity and CameraYawOffset.

Speed feedback

SpeedFeedbackController reads the character speed, whatever raised it.

Field Description
Min Speed Kmh, Max Speed Kmh Speed range of the effect. Below the minimum there is no effect.
Smooth Time Time to catch up with a speed change.
Max Fov Kick, Fov Curve Extra field of view on the run camera.
Speed Lines, Max Emission Rate, Particle Rate Curve Particle lines in front of the camera.

SpeedFovExtension is a Cinemachine extension that adds the kick to the final lens. It does not write the lens in the scene, so the base FOV does not grow with Save During Play.

SpeedFeedbackController.ResetFeedback() runs when the run is prepared. Stop() runs on the finish.

How to add a camera state

  1. Add a value to CameraState.
  2. Add a virtual camera to the Virtual Cameras object in the Game scene and a serialized field in CameraController.
  3. Set its priority in SetState.
  4. Add a blend to Camera Blends when the default blend does not fit.
  5. Call CameraController.SetState from GameController.