Search Unity

Fixed camera doesn't switch to "main" follow up camera when falling out of sight

Discussion in 'Cinemachine' started by andreyefimov2010, Jun 11, 2018.

  1. andreyefimov2010

    andreyefimov2010

    Joined:
    Oct 29, 2017
    Posts:
    44
    I have two virtual cameras parented to object with Cinemachine Clear Shot script. This script has Look at targeted to the character. First camera is supposed to be static and has Aim set to Do nothing to force the static behavior. Character initially is positioned in front of it. Second camera is standard third person view camera and should be activated only when characters moves out of the first camera sight. Priority of the first camera is set to be higher than that of the second.

    What I'm getting is the cameras are never switched. First camera is always active even when character becomes invisible on the first camera.

    First 'static' camera settings:
    upload_2018-6-11_20-39-40.png

    Second camera:
    upload_2018-6-11_20-40-9.png

    Parent object:
    upload_2018-6-11_20-40-55.png
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Try putting the Collider on the ClearShot parent instead of on the 2 child vcams
     
  3. andreyefimov2010

    andreyefimov2010

    Joined:
    Oct 29, 2017
    Posts:
    44
    The same result.
     
  4. andreyefimov2010

    andreyefimov2010

    Joined:
    Oct 29, 2017
    Posts:
    44
    If by default you mean third person view camera then it becomes always active. If the other one then it doesn't change anything.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    By default I mean the camera that you want to use if both are valid (the static camera, if I understand your question correctly).

    If the cameras are not switching it's because the collider doesn't think the target is obstructed. Either this is because
    1. it doesn't believe there's a target (note the "No LookAt" warnings in your images - that's why I suggested you move the collider. Do you still have those warnings?), or
    2. it doesn't recognize the obstacles. Do they have Unity Colliders, and are they on the right layer so that the CinemachineCollider can see them?
     
  6. andreyefimov2010

    andreyefimov2010

    Joined:
    Oct 29, 2017
    Posts:
    44
    Yeah, default means static then.
    1. I got now Look At set to all entities (2 vcams and parent). Warning is shown on either of them (where Collider component is present) - ???
    2. All of geometry has colliders but I don't think it should come into play here - the character is not obstructed by geometry, it merely falls out of the first (static) camera frustum. I expect camera to be switched to third person at that point.
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    1. I don't understand why that warning is there.
    2. Yes that's a use-case that was overlooked in the current version of CM. We're releasing CM 2.2.0 later this month which will behave as you require.
     
  8. andreyefimov2010

    andreyefimov2010

    Joined:
    Oct 29, 2017
    Posts:
    44
    1. Yeah, me too;)

    upload_2018-6-11_21-21-28.png

    2. Glad to hear that! Thanks!
     

    Attached Files: