Search Unity

StateDrivenCamera and Priority

Discussion in 'Cinemachine' started by Lazulite, Jul 20, 2018.

  1. Lazulite

    Lazulite

    Joined:
    Oct 14, 2017
    Posts:
    2
    I have a pretty simple StateDrivenCamera setup, 2 vcams, one for locomotion and the other for combat.
    When in Locomotion State, the locomotion vcam is used, and when in Combat State, the combat vcam is used, straightforward, and it works.

    Now, I would like to change the LookAt target on combat vcam. I could just change the LookAt target from script and although it works, instead of blending, it cuts.
    According to post on other thread, it is by design that a target switch on a vcam acts as a cut, not as a blend and for smooth blend, a 2nd vcam is required.

    So I tried to do it. Now I have 2 combat vcams.
    When target is changed, I changed the LookAt target of the other combat vcam, lower the current combat vcam priority and boost the other combat vcam priority.

    My setting on Cinemachine State Driven Camera script is:
    - State: Locomotion, Camera: LocomotionVCam
    - State: Combat, Camera: CombatVCam1
    - State: Combat, Camera: CombatVCam2

    From the inspector, all the values seems to be right, the combat vcams change priorities and LookAt target accordingly, but the active camera never changed.
    With the above settings, the active vcam only change between LocomotionVCam and CombatVCam2, even when CombatVCam2 have lower priority than CombatVCam1, CombatVCam1 was never active.

    I was under the assumption that when multiple VCam is set on the same State, the highest priority will be active, am I understanding this wrongly?
    Am I supposed to set this up differently?

    =====================================================================

    Edit:
    Instead of setting the 2 combat vcams directly inside the State Driven Camera script, I first wrap the 2 combat vcams with Clear Shot, and then set that Clear Shot vcam inside the State Driven script.
    Now my setting look kinda like this:
    On StateDrivenCamera script
    - State: Locomotion, Camera: LocomotionVCam
    - State: Combat, Camera: ClearShotVCam
    On ClearShot script I have the 2 combat vcams set as the children and using default blend

    This setup works, kind of
    Sometimes the blend is a bit weird, but that's probably because how I setup my combat vcams (those vcams seems to think that the ideal angle is top-down, I've been struggling for a while to figure this out but I think this is a question for another thread)

    Although this work, I'm not sure if this is really the ideal solution,
    If anyone could suggest a better options, I'd really appreciate it!
     
    Last edited: Jul 20, 2018
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    In the current imlementation StateDrivenCamera doesn't use priority to choose between multiple vcams mapped to the same state. In fact, there really is no handling for that situation at all. However, it's a good idea and we'll look into adding that feature.
     
    mandisaw likes this.
  3. Lazulite

    Lazulite

    Joined:
    Oct 14, 2017
    Posts:
    2
    Ah, I see, so that's why the active vcam doesn't change.
    Thank you for clarifying!
    Cinemachine is awesome (even more so when combined with Timeline), I'm really looking forward to future features!
     
  4. kureysalp

    kureysalp

    Joined:
    Oct 1, 2017
    Posts:
    10
    And still we didn't get that feature. Actually that should not be even a feature that should be a default behaviour. Lots of devs on the internet tried this instinctly and failed, even you commented those topics "not recommended to use this way".
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    The feature is coming in the next release (CM 3.0.0-pre.8).