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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

How to make boundaries for cinemachine?

Discussion in 'Editor & General Support' started by KimMingyuSVT, Sep 18, 2020.

  1. KimMingyuSVT

    KimMingyuSVT

    Joined:
    May 28, 2019
    Posts:
    7
    Hello

    I am trying to achieve same camera settings as in the video I am attaching below

    Video: https://drive.google.com/file/d/1jtb3D9qzOE3NYC6DuWkDCXflPWYT-nuz/view?usp=drivesdk

    My project have similar concept as in the video, you go up on tapping and thus I want to achieve the same camera settings

    As you can see, when I tap and cube goes up the camera starts moving only after cube have reaches a certain position, and after going up a bit the camera locks and doesn't allow to go down anymore. I want to have same as this, go up and camera moves after a certain position and after a certain distance it locks. I am using cinemachine. If there's any way to do it without script or I have to code. Please help
    Thanks
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,238
    I don't think you will be able to do this without some simple scripting. I would make an invisible GameObject which will serve as the camera's Follow target. Attach a custom script to it that will move it upwards to follow the player if and only if the player is higher than it.

    Then make a CM 2D camera (Framing Transposer in Body section) that uses the invisible object as a Follow Target.
     
  3. KimMingyuSVT

    KimMingyuSVT

    Joined:
    May 28, 2019
    Posts:
    7
    I see, I am kinda new to cinemachine and unity tho, but how to do the boundaries with script then
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,238
    Maybe it's time to learn some Unity scripting. This is not Cinemachine-specific, just a basic script to make a game object position itself in relation to another.

    Here are some learning resources: https://learn.unity.com/search?k=["q:Scripting"]
     
  5. KimMingyuSVT

    KimMingyuSVT

    Joined:
    May 28, 2019
    Posts:
    7
    Thanks, btw do you think cinemachine confiner would work? By limiting the cam movement