Dynamic starting and ending point of a cutscene

Hi!

I am working on a 3D configurator for outside props.
Using FlowCanvas, I have created a scene in which I rotate around a static 3D model, using the mouse.
The zoom is handled by a Z-axis translation of the main camera itself.

Using Cinemachine and Timeline, I have set up a cutscene with 5 virtual cameras, moving around the static 3D model. The start position (Virtual Camera 1) is the same as the ending position (Virtual Camera 5).
The CinemachineBrain is located on a sub camera, configured to hide GUI elements.
I am also using a homemade script to cancel any input from the user while the cutscene is playing.

When pressing “P”, the Timeline start and so is the cutscene.

The problem I am facing is that I want the actual position of the main camera, when pressing “P”, to be both the starting and ending point of the cutscene.

I might haven’t search the right way, and I am kinda block on this one. I tried to “cheat” a little, trying to set up fade in/out but I’ve messed myself up with it and end up here, asking for what I think to be the most flexible solution.

A short video to illustrate my words

The sub camera object


The Timeline

The StartCinematicMode.cs

```csharp
*using System.Collections;
using UnityEngine;
using UnityEngine.Playables;
using FlowCanvas;

public class StartCinematicMode : MonoBehaviour
{
#region Cinematic Logic
[SerializeField] FlowScriptController rotationFlowController;
[SerializeField] FlowScriptController cameraFlowController;

[SerializeField] private GameObject mainCamera;
[SerializeField] private PlayableDirector myDirector;
#endregion

private void Start()
{
rotationFlowController = mainCamera.GetComponent();
cameraFlowController = mainCamera.GetComponent();
}

private void Update()
{
if (Input.GetKeyDown(KeyCode.P))
{
StartCoroutine(PlayCutScene());
}
}

IEnumerator PlayCutScene()
{
// disable rotation logic
rotationFlowController.enabled = false;
cameraFlowController.enabled = false;

// disable the main camera
mainCamera.SetActive(false);

   myDirector.Play();

// wait for the timeline sequence to end
yield return new WaitUntil(() => myDirector.state == PlayState.Paused);

   mainCamera.SetActive(true);
   rotationFlowController.enabled = false;
   cameraFlowController.enabled = true;

}
}*
```

Put a passive CinemachineVirtualCamera behaviour on the main camera (by passive I mean Aim and Body set to DoNothing). Give this vcam higher than default priority. This way, when you activate the subcamera with the CM Brain, it will take on the exact position of the main camera. That is your default CM camera.

Next, in the timeline, set the ease-in time for your first CM shot to be non-zero. This will make that shot blend in from the default camera. Similarly, set the ease-out time of the last CM clip to non-zero, and it will blend back into the default CM camera at the end.

6069519--657837--upload_2020-7-8_17-48-43.png

1 Like

Hi! Thx for the reply!

I thought it would have been much more difficult.
But strangely, adding the MainCamera at the end of the Timeline make the blend transition happen (the starting blend is working fine without adding the MainCamera at the begining of the Timeline).
Yet, it is working. I must now add a quick fade in/out for the UI and I will be good!

Many thanks @Gregoryl