Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    6
    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:
    1,312
    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:
    6
    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:
    1,312
    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:
    6
    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:
    1,312
    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:
    6
    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:
    6
    You were absolutely right. Nice feature indeed. :)