Search Unity

Cut between timelines

Discussion in 'Cinemachine' started by specular12, Sep 26, 2018.

  1. specular12

    specular12

    Joined:
    Jan 28, 2014
    Posts:
    16
    Hello!
    I'm having trouble cutting between timelines. Cinemachine seems to revert back to a 2 second blend, even though I have the default blend on the Cinemachine brain blend set to cut.

    I have a timeline with a looping wide shot and I would like to cut to another timeline cut scene with a dolly track (close up shot) whenever the player presses a button. Once the dolly sequence timeline is complete, the camera goes back to the looping wide shot timeline. The button uses PlayableDirector.Play() to start the timeline.

    It works, or cuts, the first time through. However, the 2nd, and subsequent, times the button is pressed Cinemachine does a 2 second blend instead of cut. Since the wideshot is in outer space showing a planet and the closeup is on the ground, blending doesn't work.

    I have tried: -customs blends set to cut between the two cameras
    -putting the wideshot camera on the 2nd timeline (dolly) for a few frames, but this doesn't work as Cinemachine is defaulting to a 2 sec. blend
    -setting the ease in / out to 0, as well blend curves on to manual and flat
    etc., etc.

    Is there a way to force the camera to cut?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    All blend settings are ignored when it comes to vcams invoked from the timeline. Timeline controls the blending 100%. Can you show me the timeline that plays the close-up? And the code that invokes it? Does the 2-second-blend happen when the close-up starts, or ends, or both?
     
    Last edited: Sep 27, 2018
  3. specular12

    specular12

    Joined:
    Jan 28, 2014
    Posts:
    16
    Here's the whole timeline for the close up sequence.

    close up all.jpg
    That sequence is embedded in this timeline:

    close up deriviative timeline.jpg

    It is triggered at the end of this sequence, which basically goes to black for 20 frames and then fires the close up animation (the fade in from black is the derivative forward timeline). As you can see, the timeline calls the next timeline (forward derivative) with a script on an empty game object through an activation track and OnEnable() on the script.

    goToBlack.jpg

    Code (CSharp):
    1. public class RunAnimation : MonoBehaviour {
    2.  
    3.     public PlayableDirector[] cameraMoves;
    4.     public PlayableDirector goToBlack;
    5.     public TextControlOrbit textControlOrbit;
    6.     public Sprite[] camDirectionSprites;
    7.     public Image camDirectionImage;
    8.     public GameObject blackOutTrigger;
    9.  
    10.     void OnEnable ()
    11.     {
    12.             if (textControlOrbit.camDirectionCounter >= cameraMoves.Length) // safety check
    13.             {
    14.                 textControlOrbit.camDirectionCounter = 0;
    15.                 camDirectionImage.sprite = camDirectionSprites[0]; // fix sprite in case this fails safety check
    16.             }
    17.  
    18.             //keeps playable from getting stuck on last frame if the animation has already been played
    19.             cameraMoves[textControlOrbit.camDirectionCounter].Stop();
    20.             cameraMoves[textControlOrbit.camDirectionCounter].Play();
    21.  
    22.             blackOutTrigger.SetActive(false);  //turn off
    23.     }
    24. }
    The camera pulls back to the same spot the entire thing starts at, so I can't tell if there is a blend at the end. This solution works the first time through, but the second time the button is pressed, the timelines blend. So even though the timeline takes over camera blends within itself, what I don't understand is how do I control blending between timelines? Or is there a better way to handle this?
     

    Attached Files:

    Last edited: Sep 28, 2018
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Thanks for posting all that, but even so it's really hard for me to tell what's going on. Any chance you could post a stripped-down package that exhibits the problem? Then I could drill into it properly and help find a solution for you.
     
  5. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    There are some issues when using Activation Tracks and Control Tracks together. Playing nested timeline with Activation Tracks are causing problems because the playables generated for those tracks were ''fighting'' each other. Fixes for those issues are on the way.
     
    specular12 likes this.
  6. specular12

    specular12

    Joined:
    Jan 28, 2014
    Posts:
    16
    So I pinned down the problem. I had a couple of timelines that began with a Dolly with Track shot, and this was causing the blend. If I start the timeline with a Virtual Cam, and blend into the dolly cam, the timelines will cut. So I basically positioned my Virtual Cam near the same position as the dolly cam position 0, and the blended from the virtual cam into the dolly cam shot, and Viola! I am able to cut between timelines.

    BTW, I did have nested timelines, and did un-nest a couple of them. This did not fix the problem when the timeline began with a dolly with track shot.
     
  7. specular12

    specular12

    Joined:
    Jan 28, 2014
    Posts:
    16
    Another big issue is it takes a little while (couple of seconds actually) for the Cinemachine main camera or brain to settle. So, it helps to ensure the dolly path is set to zero via a script well before the timeline cut. My timeline had the path position starting at 0 at the beginning of the timeline, however due to the camera settling time, this wasn't soon enough
    Code (CSharp):
    1.  public class CinemachineResetPath : MonoBehaviour {  
    2.     public CinemachineVirtualCamera cm_DollyVC;
    3.     CinemachineTrackedDolly cm_Dolly;
    4.     private void Start()
    5.     {
    6.         camTargetStartPos = camTarget.position;  //
    7.         cm_Dolly = cm_DollyVC.GetCinemachineComponent<CinemachineTrackedDolly>();
    8.  
    9.     }
    10.  
    11. // fixes blend on Cinemachine dolly cameras
    12.     public void CinemachineResetPaths()
    13.     {
    14.         cm_Dolly.m_PathPosition = 0; //ensure path is reset for dolly
    15.  
    16.         camTarget.position = camTargetStartPos;
    17.         camTargetBackwards.position = camTargetBackwardsStartPos;
    18.  
    19.     }
    20. }