Search Unity

  1. We want you to join us at GDC this year! Take a peek at all of the events we will be hosting during the week of GDC.
    Dismiss Notice
  2. Tell us about your experience here and you’ll get early access to the 2018 Game Studios report + more goodies.
    Dismiss Notice
  3. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  4. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice

Camera snap to y axis values

Discussion in 'Cinemachine' started by UDN_ba83a664-16a0-437f-baaf-31cbdebe559c, Feb 13, 2018.

  1. UDN_ba83a664-16a0-437f-baaf-31cbdebe559c

    UDN_ba83a664-16a0-437f-baaf-31cbdebe559c

    Joined:
    Dec 5, 2017
    Posts:
    5
    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:
    790
    Should be possible, but I need to know more details of your vcam. Can you show me a picture of the vcam inspector?
     
  3. UDN_ba83a664-16a0-437f-baaf-31cbdebe559c

    UDN_ba83a664-16a0-437f-baaf-31cbdebe559c

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

    [​IMG]

    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:
    790
    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. UDN_ba83a664-16a0-437f-baaf-31cbdebe559c

    UDN_ba83a664-16a0-437f-baaf-31cbdebe559c

    Joined:
    Dec 5, 2017
    Posts:
    5
    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:
    790
    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. UDN_ba83a664-16a0-437f-baaf-31cbdebe559c

    UDN_ba83a664-16a0-437f-baaf-31cbdebe559c

    Joined:
    Dec 5, 2017
    Posts:
    5
    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. UDN_ba83a664-16a0-437f-baaf-31cbdebe559c

    UDN_ba83a664-16a0-437f-baaf-31cbdebe559c

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