Search Unity

Problems with cinemachine group composer

Discussion in 'Cinemachine' started by xdkSPG, Aug 16, 2018.

  1. xdkSPG

    xdkSPG

    Joined:
    Mar 13, 2017
    Posts:
    25
    I'm seeing a problem when using the group composer in our game, we are using it to frame 2 AI controlled creatures that are fighting within an arena. Most of the time it works wonderfully, but sometimes (about 1 time in 10 runs of the game) it makes severe rotations to the left or right that don't correspond with the group transform, and sometimes it fails to track the group approaching the camera and then does a very sharp 180 degree pitch rotation to catch up after the group has passed over the camera.
    I'm using a virtual camera with a cinemachine group composer component which is looking at a CinemachineTargetGroup with two targets.
    All the settings have been left with the defaults, except for the TrackedObjectOffset which is set to (0, 1, 0) as the targets y position is at floor level and we want to aim a bit higher.
    I don't have any other virtual cameras active so I'm not blending into a different camera.
    I'm using Cinemachine version 2.1.10.
    Does anyone have a clue what could cause sudden camera rotation, and suggest how it can be avoided?
    Thanks in advance!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    You didn't mention how the camera position is being controlled. If the group's bounding box encloses the camera position, you might run into trouble. How are you controlling the camera position?
     
    xdkSPG likes this.
  3. xdkSPG

    xdkSPG

    Joined:
    Mar 13, 2017
    Posts:
    25
    Thanks Gregoryl, I'll check whether that is the case.
    I was leaving the group composer to position the camera, when I tried setting the position manually it felt like I was fighting against the composer positioning.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    Normally one would put a Transposer that places the camera relative to the group center, far enough away that the camera is outside of the group's bounding box. The Group Composer then adjusts the distance to get the desired framing.
     
    far20shid and xdkSPG like this.
  5. xdkSPG

    xdkSPG

    Joined:
    Mar 13, 2017
    Posts:
    25
    Splendid, that appears to have fixed it, many thanks!
     
    Gregoryl likes this.