Search Unity

Question Cinemachine not rendering correctly with obstacles

Discussion in 'Cinemachine' started by RagnarFelipe, Oct 9, 2020.

  1. RagnarFelipe

    RagnarFelipe

    Joined:
    Aug 8, 2020
    Posts:
    9
    Hi everyone, thanks in advance,

    Have a couple of problems with Cinemachine, I am using the URP template and nothing else other than a couple of assets.

    1. The cameras seem to be lost when my player hits a collider (see picture attached)
    2. I am using the Clearshot cameras, is there a way to switch from one camera to another one without the need for an obstacle
     

    Attached Files:

  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Hi

    "Cinemachine ClearShot is a "manager camera" that owns and manages a set of Virtual Camera gameObject children. When Live, the ClearShot will check the children, and choose the one with the best quality shot and make it Live". In your case, it checks if the player is obstructed by an object from the currently active virtual camera (vcam). If the player is obstructed, then the brain switches to a vcam from which player is not obstructed.

    The behaviour in your gif is probably due to some problems with your setup. Either you vcams in Clearshot are not positioned correctly for this scene, or your colliders are not setup correctly. You could try changing the colliders on your props to simple colliders, such as boxes or spheres. If that helps, then probably your vcams are looking through small holes on your chairs, which is a problem, because as you move a tiny bit, the player becomes obstructed and thus the clear shot will change to another one.


    You don't need Clearshot for that.
    You can make any virtual camera live by changing their priority attribute. CinemachineBrain will select the virtual camera with the highest priority. Or you can disable all vcams, and just enable the one you'd like.

    If you want to change cameras based on where the player is, then you can setup trigger volumes to do that. When the player enter a trigger volume (e.g. a room), then you switch to a different virtual camera that you fine-tuned for that particular place.
     
    RagnarFelipe and Gregoryl like this.
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Also: a common mistake is to forget to ignore the player's own geometry in the CinemachineCollider. Set a minimum distance from target, or ignore the player using its tag or layer.
     
    RagnarFelipe and gaborkb like this.