Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Switching Bindings Issue

Discussion in 'Cinemachine' started by McGunn, May 24, 2019.

  1. McGunn

    McGunn

    Joined:
    Aug 7, 2012
    Posts:
    33
    Hi,

    Any help would be much appreciated.

    First I will explain what I'm trying to accomplish, then how I'm trying to accomplish it, and then what isn't working.

    Trying to accomplish
    I want the primary virtual camera of my game to work as follows:
    - The camera is third person and allows the player character to orbit around it. Using the Binding Mode Simple Follows works perfectly for this.

    - In certain areas that I have specified, I want the camera to ease into a suggested rotation and zoom level. If the player touches the camera control at all it will go back to the orbital mode. (Lock To Target binding mode works for this)

    What I'm doing
    What I'm doing to accomplish this is changing the binding mode of the virtual camera on the fly. When the player enters a trigger the camera switches to Lock To Target and it eases itself towards the suggested angle. When the player moves the camera control or exits the trigger, the camera switches back to Simple Follow.

    What is wrong

    After the first switch, the camera seems to remember it's last position from the other binding mode when it switches. So even though the camera funtions properly, when it switches binding modes it suddenly rotates to the wrong direction.

    I could technically solve this problem if I could set the Simple Follow's rotation on the same frame that I switch over to it, but as far as I can tell there is no way to do this with the Simple Follow Binding Mode.

    Video:
    https://drive.google.com/open?id=1_noid3OKdE9XhZo6LHAsq3beUUVfx2-B
    At the end of the video you can see the binding mode switch back to Simple Follow (And immediately return to the rotation that it was when it left Simple Follow) as soon as I could the camera input.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    What version of CM are you using?

    The recommended approach for this would be not to switch binding modes, but to have multiple vcams with different binding modes and blend between them.
     
  3. McGunn

    McGunn

    Joined:
    Aug 7, 2012
    Posts:
    33
    I'm using Cinemachine 2.2.9 in Unity 2018.3.11f1.

    I have briefly tried this, and I will try again more thoroughly, but how would you recommend setting the Simple Follow Camera so that when it takes control back it is at the exact same position that the other Vcam was?

    Edit:
    It more or less works with 2 Vcams. The only remaining issue is that I can't seem to figure out how to make sure that the Simple Follow camera is in exactly the same position as the Lock To Target camera when I switch back to the simple follow (I want this to be seamless, and appear as though nothing has happened except that the camera now allows the player to orbit it)
     
    Last edited: May 25, 2019
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    You have to enable "Inherit Position" in the vcams.
     
  5. McGunn

    McGunn

    Joined:
    Aug 7, 2012
    Posts:
    33
    Thank you so much. I didn't know about this option, it was exactly what I needed.

     
    Gregoryl likes this.