Search Unity

Cinemamachine follow problem

Discussion in 'Cinemachine' started by hoshicameron, Sep 14, 2019.

  1. hoshicameron

    hoshicameron

    Joined:
    Dec 20, 2015
    Posts:
    14
    Hi,I'm develop 2D pixel game in unity. everything works well before I change the sprite filter mode to point and add 2d Pixel perfect package. Now I have weird problem with cinemachine follow ability and it doesn't work properly.It shacked around The player When player stop moving. I read a lot of article but nothing changed. Also use RoundCameraPos script from @Gregoryl . 2d pixel perfect 1.0.1 and cinemachine 2.2.8.
     
    Last edited: Sep 14, 2019
    DBarlok likes this.
  2. hoshicameron

    hoshicameron

    Joined:
    Dec 20, 2015
    Posts:
    14
    MainCamera and cinemachine Setting



     
    Last edited: Sep 14, 2019
  3. hoshicameron

    hoshicameron

    Joined:
    Dec 20, 2015
    Posts:
    14
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    It looks as though the camera is correctly snapping to pixel boundaries.

    This is correct if a "pixel" in your video really corresponds to an actual pixel on the target device. However, if you're targeting devices with a higher resolution but want to emulate a low-res look (like you're doing in the video), you might want to give the camera more positional resolution. Is that what you want to do?
     
    hoshicameron likes this.
  5. hoshicameron

    hoshicameron

    Joined:
    Dec 20, 2015
    Posts:
    14
    G
    Hi, Thanks for your replay. Yes I want to use low-res sprite(16x16) in higher resolution. for that I add pixel perfect camera to my Main Camera and set the setting. but after that there was problem with cinemachine follow ability and the smoothness completely disappeared from it. I use your RoundCameraPos and it doesn't help.I changed Vsync and Anti aliasing on and off but nothing changed. I use ray casting for player movement instead unity physics.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    Maybe you shouldn't be using the RoundCameraPos script, as that is forcing the camera to remain on (big) pixel boundaries, which is what the camera is doing. You want the camera to go between those pixels.
     
  7. hoshicameron

    hoshicameron

    Joined:
    Dec 20, 2015
    Posts:
    14
    I'm not using that script on cinemachine in the captured video that i posted above. The problem is whether I use it or not use it the problem exist. I think it may be because of the damping factor .cinemachine couldn't calculate lookahead algorithm correctly. with zero damping the camera shake will disappear and it cause a bigger problem. In that setting camera movement cause a vertigo and I couldn't play it.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    If in fact your actual screen resolution is greater than the visible pixel resolution (that you have for stylistic effect), then there is no reason that Cinemachine damping would prevent the camera from positioning itself on subpixels. Do you have some other script that's forcing the camera to remain on big pixel boundaries?
     
  9. hoshicameron

    hoshicameron

    Joined:
    Dec 20, 2015
    Posts:
    14
    Just cinemachine confine with confine mode 2d. cinemachine brain update mode is smart. I also try fixed and late update.
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    Can you put together a small lightweight test project that shows this problem and PM it to me?
     
  11. hoshicameron

    hoshicameron

    Joined:
    Dec 20, 2015
    Posts:
    14
    Yes, I'll start now.