🎨
UVC
  • Introduction
  • Installation
    • Installing in New Project
    • Installing in Existing Project - SCK
    • Installing in Existing Project - MCK
  • Space Combat Kit Tour
  • Mech Combat Kit Tour
  • Player Setup
  • Vehicle Framework
    • Game Agents
    • Vehicles
    • Modules
      • Module Mounts
      • Modules
      • Module Types
      • Module Attachments
      • Display Module On UI
      • Module Managers
  • Input
    • General Input
    • Vehicle Input
    • Rewired Integration
  • Player/AI
  • Spaceships
    • Speed UI
    • Space Fighters
    • Capital Ships
  • Mechs
    • Speed UI
  • Vehicle Control Animations
  • Character Enter/Exit
  • Camera
    • Camera Setup
    • Vehicle Setup
    • Secondary Cameras
    • Death Camera
  • Weapons
    • Framework
      • Triggerables System
      • Weapon System
    • Vehicle Setup
      • Vehicle Weapons
      • Cursor Aiming
    • Projectile Weapons
    • Beam Weapons
    • Missile Weapons
    • Resource Handling (Ammo/Heat)
    • Turrets
    • HUD Weapon Info
    • Health Modifier Volumes
  • Radar
    • Radar Setup
    • Target Setup
    • Target Selectors
    • Trackable Types
    • Improving Radar Performance
    • Target Notification
    • Radar Audio
  • Health
    • Health Framework
      • Health
      • Damageable
      • Damage Receiver
      • Health Modifier
      • Health Types
      • Health Modifier Types
      • Surface Types
    • Vehicle Setup
    • Damageable Object Setup
    • Detonators
    • Health Recharge
    • Health UI
    • Energy Shield
    • Damageable Module Linkers
  • HUD
    • HUD Basics
    • HUD Manager Setup
    • Custom HUD Components
    • HUD Module Display
    • Camera View Management
    • HUD Cursor / Reticle
    • Weapon UI
    • Resource Container UI
    • 2D Radar
    • 3D Radar
    • Target Boxes
    • Target Holograms
    • Minimaps
    • HUD Distance Lookup
  • Loadout
  • AI - Space Combat Kit
    • AI Setup
    • AI Spaceship Behaviours
  • AI - Mech Combat Kit
  • Game States
  • Teams
  • Floating Origin
  • Object Pooling
  • Menus
    • Creating Menus
    • Button Controllers
  • Rumbles
  • Rigidbody Characters [WIP]
  • Utilities [WIP]
    • Object Triggers
    • Shadow Caster Doubles
    • Gimbals
    • Game State Post Process Enabler
  • Objectives
  • Resources System
    • Resource Containers
    • Resource Handlers
    • Resource Container Triggers
    • Module/Vehicle Resource Usage
    • UI
  • Cutscenes
  • URP Upgrading
Powered by GitBook
On this page
  • Cinemachine Setup
  • Handling Ship Functionality (SCK)

Was this helpful?

Cutscenes

How to set up basic cutscenes with Cinemachine.

PreviousUINextURP Upgrading

Last updated 9 months ago

Was this helpful?

If you're looking for information on how to set up a basic cutscene with Cinemachine, and handling the toggling of vehicle functions while transitioning in and out of a cutscene, you'll find it here.

If you have any problems using the steps below, please watch the video above, which demonstrates everything shown here.

Cinemachine Setup

First, install the Cinemachine package using Unity's package manager, if it's not installed already.

The next thing you want to do is go to the main camera inside the Vehicle Camera's hierarchy and add a CinemachineBrain component.

The next thing you'll want to do is add a CinemachineVirtualCamera to represent the vehicle camera. Go into the Vehicle Camera's hierarchy in your scene and add a new gameobject as a sibling of the main camera, with zero local position and rotation. You may have to adjust the 'Field of View' and 'Far Clip Plane' settings of the virtual camera to match the camera.

Next, create a new gameobject for your cutscene camera, add a CinemachineVirtualCamera component, set its 'Look At' to the player ship, and set the 'Aim' to 'Hard Look At' (you can customize these settings however you wish, this is just for the example).

Now, as long as the cutscene virtual camera's Priority is higher, simply enabling it will switch to the cutscene camera, and disabling it will switch to the vehicle camera.

Handling Ship Functionality (SCK)

When using the Space Combat Kit, when you go into or out of a cutscene, you may want to do things like:

  1. Toggle the cutscene camera on and off

  2. Toggle the controls of the ship

  3. Toggle the HUD

  4. Toggle the rigidbody on/off (for example if you want to animate the ship along a path during the cutscene).

Here is an example script called 'TestCutscene' that will enter or exit a cutscene whenever you press the 'C' button, and handles the tasks listed above. Just add it anywhere in your scene to see how it works.

using Cinemachine;
using UnityEngine;
using VSX.UniversalVehicleCombat;
using VSX.UniversalVehicleCombat.Radar;

public class TestCutscene : MonoBehaviour 
{ 
    public CinemachineVirtualCamera cutsceneCamera;
    bool isCutscene = false;
    
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.C))
        {
            if (isCutscene)
            {
                cutsceneCamera.enabled = false;
    
                Vehicle ship = GameAgentManager.Instance.FocusedGameAgent.Vehicle;
                Engines engines = ship.GetComponent<Engines>();
    
                engines.ControlsDisabled = false;
    
                ship.GetComponent<Rigidbody>().isKinematic = false;
    
                ship.GetComponent<HUDManager>().ActivateHUD();
    
                isCutscene = false;
            }
            else
            {
                cutsceneCamera.enabled = true;
    
                Vehicle ship = GameAgentManager.Instance.FocusedGameAgent.Vehicle;
                Engines engines = ship.GetComponent<Engines>();
    
                engines.SetSteeringInputs(Vector3.zero);
                engines.SetMovementInputs(Vector3.forward);
                engines.ControlsDisabled = true;
    
                ship.GetComponent<Rigidbody>().isKinematic = true;
    
                ship.GetComponent<HUDManager>().DeactivateHUD();
    
                isCutscene = true;
            }            
        }
    }
}

How to set up basic cutscenes with Cinemachine and SCK.
Add a CinemachineBrain to the camera.
Add a CinemachineVirtualCamera component to represent the vehicle camera, and set it to a low priority (e.g. 0).
Add your cutscene camera.