Search Unity

[Cinemachine] Pinning to corner of safezone

Discussion in 'Cinemachine' started by relational_agents_ted, Apr 11, 2017.

  1. relational_agents_ted

    relational_agents_ted

    Joined:
    Jul 25, 2016
    Posts:
    8
    I have an issue with my Cinemachine 1.1 setup. I feel like it's probably my error, but I can't figure out how to fix it.

    I have a virtual camera configured to track the head bone in our character's rig and keep that point in roughly the upper left quadrant of the screen. The character is designed to shift and move slightly throughout the scene. I'd like the camera to keep her in the left side of the screen, but not track her every subtle shift. I'm using a wide safezone to get this effect. Regardless of how I configure it, though, it seems that Cinemachine is pinning the target bone to the bottom right corner of the safezone. When the character shifts, the camera tracks her movement perfectly. This happens regardless of whether I use hard or soft bounds to frame the safezone.

    Did I possibly miss something when I was setting up my Cinemachine rig?

    2017-04-11_1017.png

    Video demo:
    https://www.screencast.com/t/fAlasEmja9

    Virtual camera setup:

    2017-04-11_1038.png

    Script Execution Order:

    2017-04-11_1038_001.png
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    The soft zones are relevant only when damping > 0. If you turn up the damping in the composer, then you will get softer tracking, as the composer will allow the camera to drift into those soft zones.

    For the bottom-right corner thing, that will probably not happen if you upgrade to Cinemachine 1.5, available here:
    https://forum.unity3d.com/threads/new-cinemachine-v1-5.459352/

    To upgrade, it's best to delete any Cinemachine-related objects from your scene, then delete the old Cinemachine directory from your assets, then install the new one.

    Note: when importing the new Cinemachine, be sure to uncheck the "Timeline" and PostFX" subdirectories, which contain scripts that are dependent on upcoming or optional Unity features.
     
    Last edited: Apr 11, 2017
  3. relational_agents_ted

    relational_agents_ted

    Joined:
    Jul 25, 2016
    Posts:
    8
    I updated to Cinemachine 1.5 as described, and now it pins to the center of the safezone. That's slightly better, I suppose, but the character's breathing animation is still causing the camera to move.

    Video demo:
    https://www.screencast.com/t/iGWQFYxxx

    Virtual Camera settings:
    2017-04-11_1406.png
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Was your video made with the game playing, or just in edit mode? In Edit mode (game not playing) the camera always snaps to the center of the dead zone. When the game is running, the dead zone really is a dead zone.
     
  5. relational_agents_ted

    relational_agents_ted

    Joined:
    Jul 25, 2016
    Posts:
    8
    Nope, that was while the game was running.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Were you just dragging the character around with the mouse?
     
  7. relational_agents_ted

    relational_agents_ted

    Joined:
    Jul 25, 2016
    Posts:
    8
    In that video, I was. I know there's some issues with non-smooth movement. However, I still see camera movement with our simple breathing animation. Its hard to record using that software because the capture framerate is slow.

    Here's a higher rez, higher framerate video with more subtle, smooth movements. Similar behavior:
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Here is my scene hierarchy.

    I'm wondering if you're moving the camera along with the character. That would mean that the camera would always be looking exactly at the character's face, which is what you're getting. Try as an experiment to set your vcam's body method to HardConstraint, and just place it somewhere in the office.
     

    Attached Files:

  10. relational_agents_ted

    relational_agents_ted

    Joined:
    Jul 25, 2016
    Posts:
    8
    I think I found my error. When I first turn on the Virtual Camera, I call

    Brain.SetCameraOverride(10, Brain.CurrentActiveVirtualCamera(), Camera, 1, 0);

    where Brain is the CinemachineBrain and Camera is the Virtual Camera I'm turning on. When I remove that line, the camera behaves as intended.

    I call that function because I want to be absolutely certain that Camera becomes the active virtual camera, without messing with priority settings. I'm guessing that's not what that function is intended to do, huh?
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Never call that function. It's for Timeline API only. The brain will automatically find the enabled vcams and choose the one with the highest priority. You control which vcam is live by enabling/disabling them, or by managing their priorities.
     
  12. relational_agents_ted

    relational_agents_ted

    Joined:
    Jul 25, 2016
    Posts:
    8
    Noted. Thanks for your help! 1.5 seems to be working great, now that I know how to use it. :p
     
    Adam_Myhill likes this.