Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

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:
    6
    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:
    1,218
    Try putting the Collider on the ClearShot parent instead of on the 2 child vcams
     
  3. andreyefimov2010

    andreyefimov2010

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

    andreyefimov2010

    Joined:
    Oct 29, 2017
    Posts:
    6
    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:
    1,218
    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:
    6
    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:
    1,218
    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:
    6
    1. Yeah, me too;)

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

    2. Glad to hear that! Thanks!
     

    Attached Files: