Search Unity

skipping a cutscene

Discussion in 'Cinemachine' started by jdeuce, Nov 8, 2017.

  1. jdeuce

    jdeuce

    Joined:
    Dec 15, 2012
    Posts:
    22
    I implemented the new Cinemachine 2D stuff in my new game for the opening sequence, which transitions between cameras for: level overview cam => objective cam 1 => objective cam 2 => objective cam 3 => level overview => game cam for however many objectives are in the scene.

    This is the timeline:
    https://i.imgur.com/OTOGJUv.png

    The net result is a nice clean opening sequence
    https://i.imgur.com/02NKR2r.mp4

    The only problem is after you've tried the level a few times it can get boring so I need to implement skipping of the sequence.

    My current implementation has two levels of skipping, where the first skip is to the countdown, and the second skip can bypass the countdown as well. It works by just advancing the playable director to the right timestamps in the clip.

    The first skip is not terrible but you can see it does a full harsh cut to the level camera when a very quick transition would be preferred:
    https://i.imgur.com/8Br2qYW.mp4

    The second skip is worse because the cut between the level camera and the actual game camera is a little more harsh:
    https://i.imgur.com/Fu4BITQ.gifv

    There was another thread with some discussion about skipping here https://forum.unity.com/threads/tra...imeline-animation-skipping-a-cutscene.502526/. The solution proposed was to swap to a second timeline. I could probably do that for the countdown skip because that one is always from the level overview camera to the game camera. But the first skip to the countdown is trickier as they might want to skip while it is is on any of the 3 (or more/less, depending on scene) objective cameras. And so to use that method I would need to make 3 skip timelines, for each objective they could trigger the skip from and then wire my skipping script up to know which skip timeline to use for which position in the timeline.

    Is there a better way to achieve a smooth cut?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    You don't need to do all the combinations. The key thing to know is that it's possible to fade a Cinemachine clip in from nothing. What that does is blend in from whatever camera was previously active, be it in another timeline clip, or the game camera.

    Here, the second track on the timeline has such a clip. It will just blend in the game cam. When it ends, it will release the override, and if at that time there is no other timeline active and the GameGam has highest priority, GameCam will remain active.

    upload_2017-11-8_15-3-38.png

    upload_2017-11-8_15-6-22.png

    So, for example, to skip to the game camera with a quick blend, just enable a new timeline with a fade-in clip to the game camera, whenever the key is pressed. It will blend in from whatever camera was active at the time it was enabled - even if that camera itself was mid-blend between multiple vcams.
     
    djDavidj likes this.
  3. jdeuce

    jdeuce

    Joined:
    Dec 15, 2012
    Posts:
    22
    Ah right, I definitely didn't realize you could just have an open blend like that at the beginning.

    Thanks for the quick reply, this is absolutely going to help. Can't wait to try it out. I am loving cinemachine more and more every day.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    You can also have an open blend at the end, which I didn't illustrate, but which could also be useful in your situation.
     
  5. jdeuce

    jdeuce

    Joined:
    Dec 15, 2012
    Posts:
    22
    I tried it out but it didn't really seem to work like I wanted to, although those open blends are still going to be useful for other scenarios.

    So to try it out I created a second shorter timeline like this:
    timeline.png
    and then triggering a skip would stop the longer timeline and start another playable director with this shorter timeline.

    What ends up happening is that it quickly cuts to the game camera (as it is the highest priority after stopping the first timeline) and then blends from there to the level cam, rather than blending from the shot that the timeline was on when I triggered the skip as I was hoping.

    I also tried a slightly different approach throwing a different camera transition on another track of the same timeline, and then having my script mute the original track and unmute a track with the shorter transition, along with my earlier timestamp scrub to the skip position, but it's the same problem where it cuts back to the game cam and then transitions from there.
    timeline2.png
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    The problem might be that you're stopping the first timeline too quickly. Leave it running until the short clip has completely blended in, then stop it.
     
  7. jdeuce

    jdeuce

    Joined:
    Dec 15, 2012
    Posts:
    22
    I just tried that, it does achieve the blend!! Although now I have to contend with content from the other tracks blending when both timelines are enabled together. Which I am thinking of solving by muting the extra tracks in code, but it feels a bit awkward as the mute state gets remembered after I stop the game and go back to the editor.
     
  8. jdeuce

    jdeuce

    Joined:
    Dec 15, 2012
    Posts:
    22
    I ended up switching from using a cinemachine track, to using a set of activation tracks that turn on and off the various cameras in the scene. The default blend on the cinemachine brain then ends up handling the transitions the same way I had them in the cinemachine track.

    Implementing the "skip" functionality is then still just a matter of scrubbing the timeline to where I want like these red lines: timeline3.png

    Pretty happy with the way it's working now.
     
    Adam_Myhill and Gregoryl like this.