Search Unity

Prevent Cinemachine timeline from resetting

Discussion in 'Cinemachine' started by HaddicusGames, Jan 23, 2018.

  1. HaddicusGames

    HaddicusGames

    Joined:
    May 28, 2014
    Posts:
    28
    I'm using Cinemachine for a intro animation where the camera pans from one room to another, on a starting title. Everything is great, except, when the pan is done, it returns back to the original location... and I can't seem to find any sort of setting to prevent that from happening? I've searched google and the forum, but I'm not coming up with anything specific to stopping the timeline from looping... am I missing something blatantly obvious? It really shouldn't be this difficult to prevent a timeline from restarting... right?
     
  2. LezCT

    LezCT

    Joined:
    Nov 15, 2014
    Posts:
    55
    Disable all the cameras with activation playable asset to avoid blending to active vcam after the timeline is done playing.
    I usually put all my vcam on a gameobject then control the object's active state.
    here's the example.
    upload_2018-1-23_14-51-29.png
    by default, disable the camera parent. and the activation playable asset's post playback state should be "inactive"
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    It's not the timeline that's looping (although there is a setting to make it do that), it's because you haven't set up the right thing to happen when the timeline ends.

    The way to think about CM tracks in the timeline is that the timeline tracks override the CM camera that is active at the time the timeline track starts. When the timeline track ends, so does the override, and camera control is returned to the active vcam. You need to set up a vcam that is ready to take over when the timeline ends.

    If the CM clip on the timeline ends abruptly, then you will cut to the active vcam. If you give the clip an ease out, the vcam will blend in smoothly.

    Click on the clip and edit the ease out property in the inspector:
    upload_2018-1-23_10-52-36.png

    upload_2018-1-23_10-52-54.png
     
  4. HaddicusGames

    HaddicusGames

    Joined:
    May 28, 2014
    Posts:
    28
    @Gregoryl Thank you for the explanation! I've been trying to wrap my head around Timeline/Cinemachine and believe I just had a lightbulb go off in my head... thanks for leading me to the light ;)
     
  5. FurySven

    FurySven

    Joined:
    Jan 12, 2019
    Posts:
    5
    Thanks Gregoryl! That works for me!
     
  6. Brentos13

    Brentos13

    Joined:
    Mar 12, 2018
    Posts:
    2
    Hi @Gregoryl , not sure if this belongs in a separate thread, but it's kind of related... but when my scene finishes play (it's an intro) the camera reverts back to the main camera on the scene and not the VCam. This is typically what I would want, however, when the CM Brain was added to my main camera it moved it's original position and cannot be moved as long as the CM is active. Can you override the main camera?
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    The paradigm is that you have one Camera (with a CM Brain), and multiple vcams - some activated via timeline, others for gameplay. You don't ever animate or position the main camera. It positions itself, taking instructions from the current active vcam.

    So, whatever code you had animating the Camera, make it animate a vcam instead, and when that vcam is active the Camera will track it exactly.

    Vcams can animate either procedurally (tracking their targets), or manually via scripts of your own, the same way you would animate a normal camera. In the latter case, make sure you put "Do Nothing" in the Aim and Body sections of the vcam, to turn off the procedural algorithms.
     
    Brentos13 likes this.
  8. Brentos13

    Brentos13

    Joined:
    Mar 12, 2018
    Posts:
    2
    Thank you, Sir! The weird thing is, I didn't animate the main camera, yet it was reverting back. But I think my timeline was too long, once I shortened to end at the exact point I was able to get it.
     
  9. alexanderFabula

    alexanderFabula

    Joined:
    Sep 1, 2019
    Posts:
    22
    Hey

    I have a problem that relates to using CM cams with timelines

    I have two timelines connected via an event when the first timeline ends, it starts the second one. The first timeline ends with a cut and the second timeline start without ease in duration. The camera makes a jump between the timelines. When I start the first timeline a camera is active let's call it X. In the middle of the first timeline I use a signal to activate another camera (Y), Y is the camera that the second timeline starts with. But when I start the second timeline I can see in the CM Brain that it is making a blend between X and Y. I don't understand why X is in this blend. it's not the active CM at that moment, but it was when the first timeline started.

    Here is a picture of the blend in the CM Brain.

    upload_2023-1-26_17-36-10.png
     
  10. alexanderFabula

    alexanderFabula

    Joined:
    Sep 1, 2019
    Posts:
    22
    I think it can be because of the the two cameras are in-blend while the timeline are playing and are not done when exiting the timeline
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    The CM Timeline tracks function as overrides to the built-in blending system. When a CM Shot in a timeline is active, it defines the current active camera, and the clip's blend settings (ease-in/ease-out) define the blend state. The priorities and blend system are only relevant in the frames where there is no active CM timeline clip.

    So, when you activate a timeline, you should not first activate the vcam with a signal - it isn't necessary and can confuse things. Try starting the second timeline a frame or two before the first one finishes. The most-recently-activated timeline track will override all the others, so you can have multiple tracks active at the same time, allowing you (if you want) to blend in and out agnostically with whatever happens to be active.