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

Camera snap to y axis values

Discussion in 'Cinemachine' started by Devilly, Feb 13, 2018.

  1. Devilly

    Devilly

    Joined:
    Dec 5, 2017
    Posts:
    14
    Currently my camera follows the player with some vertical damping and a vertical dead zone. Now while I like the damping the dead zone is not exactly what I want. What I'm envisioning is that I can say "let the camera snap to 10 on the y axis when the player is between 5 and 15 and snap the camera to 0 when the player is between -5 and 5". The snapping I'd like to happen gradually so while preserving the dampened movement.

    Is something like this possible without coding it myself?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Should be possible, but I need to know more details of your vcam. Can you show me a picture of the vcam inspector?
     
  3. Devilly

    Devilly

    Joined:
    Dec 5, 2017
    Posts:
    14
    Of course:



    Though, really, the main thing is the snapping so if anything has to change to make that happen that would be fine.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    I would do it with 3 vcams, each set to the different Y position, and blend between them when the player moves into the respective zones.
     
  5. Devilly

    Devilly

    Joined:
    Dec 5, 2017
    Posts:
    14
    Thank you for your input though I'm not sure this feels like a nice solution. I didn't yet know about the blending which can be set in the cinemachine brain but I'll play some with it to see if I can get it to work the way I want it to.
     
    Last edited: Feb 14, 2018
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    One of the key features of Cinemachine is the concept of camera blending. This means that when one vcam is deactivated and another one activated, you can control the way the transition occurs: straight cut, or smooth transition. The default is a 2-second smooth transition, but you can change this in CinemachineBrain. You can also set up custom transitions for any camera pair. Wildcards too.

    This is a very powerful feature, and I think it's exactly what you need to be looking at.
     
  7. Devilly

    Devilly

    Joined:
    Dec 5, 2017
    Posts:
    14
    I just changed my response. Thanks for the extra heads-up. I'll let you know if I can get it to work the way I want.
     
  8. Devilly

    Devilly

    Joined:
    Dec 5, 2017
    Posts:
    14
    You were absolutely right. Nice feature indeed. :)