Search Unity

Skip Transition Time

Discussion in 'Cinemachine' started by gregmax17, Sep 13, 2020.

  1. gregmax17

    gregmax17

    Joined:
    Jan 23, 2011
    Posts:
    186
    I have 2 Virtual Camera's in my scene, A and B. In my Cinemachine Brain I set it so when it transitions from A to B it takes 4 seconds with a Ease In and Out style. No problems, works great (awesome tool!).

    But now I want it so when the user presses the Space bar, it just cuts from A to B? Or at the very least change the 4 seconds to something like 0.1 seconds via C#?

    Some quick pseudo code would be appreciated!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    You can use the
    CinemachineCore.GetBlendOverride
    delegate. Install a custom handler that checks for the spacebar key, and returns a Cut blend if pressed, or the unmodified blend if not.

    This delegate is called whenever a blend is about to be initiated. Your handler can keep the intended blend, or return a modified one to override it.

    See https://docs.unity3d.com/Packages/c...CinemachineCore.GetBlendOverrideDelegate.html
     
  3. gregmax17

    gregmax17

    Joined:
    Jan 23, 2011
    Posts:
    186
    Thank you for the reply. I follow what you are saying, however, I really would appreciate some pseudo code - I don't understand how to use delegates :(

    Also, how would this work if the blend is currently in transition? If its currently transition from A to B, and its about 25% through the blend, is there anyway to jump cut to the end?
     
    Last edited: Sep 13, 2020
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    The only way to interrupt a blend is to activate a new vcam. So maybe the best way forward for you is to forget the delegate, and instead make a new vcam C that's exactly the same as B, except that when spacebar is pressed you activate it, and it's set up to always cut.