Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Callback for OnBlend(t)

Discussion in 'Cinemachine' started by matt_cauldron, Mar 10, 2022.

  1. matt_cauldron

    matt_cauldron

    Joined:
    Dec 17, 2021
    Posts:
    48
    Hi There,

    I'm hoping for a callback during a transition with the progress of the transition 't' passed into the parameter, so I can sync another animation to a cinemachine camera blend, e.g. pseudo code like:

    Code (CSharp):
    1. {
    2.   Cinemachine.tranistion[0].RegisterBlendCallback(OnCamBlendUpdate);
    3. }
    4.  
    5. void OnCamBlendUpdate(float t)
    6. {
    7.   syncedGameObj.position = Vector3.Lerp(start, end, t);
    8. }
    Is there a simple way to achieve this?

    Thanks in advance
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    You can get an event when the vcam is activated (start of blend). Then, you would have to poll CinemachineBrain.ActiveBlend to monitor the progress. That would be given by TimeInBlend/Duration.
     
    matt_cauldron likes this.