Search Unity

Question How to switch between confiner components

Discussion in 'Cinemachine' started by duyvnlx3016, Jan 20, 2023.

  1. duyvnlx3016

    duyvnlx3016

    Joined:
    Jan 12, 2023
    Posts:
    2
    I'm a newbie in unity. I am developing a platform game. I draw a bounding shape inside another bounding shape, these 2 shapes I put in 2 vcams, how can I activate the vcam of the big shape when I get out of the small shape and vice versa.
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    You can use CinemachineTriggerAction's On Object Exit functionality.

    In your case, add CinemachineTriggerAction script to the small shape.
    On Object Enter, you active the vcam - small shape.
    On Object Exit, you deactive the vcam - small shape.

    There may be some minor tweaks needed depending on your map.
    If your player starts in the small shape area, then the above solution will work reliably if vcam - small shape's priority value is bigger than vcam - big shape's priority value.
     
  3. duyvnlx3016

    duyvnlx3016

    Joined:
    Jan 12, 2023
    Posts:
    2
    Thank you for your help!!!