Search Unity

Clear shot randomize choice is not working

Discussion in 'Cinemachine' started by Mozq8, Nov 5, 2020.

  1. Mozq8

    Mozq8

    Joined:
    Dec 30, 2016
    Posts:
    61
    Unity 2019.4.13
    Cinemachine latest update from Package Manager.
    So basically I want to create a list of randomized cameras with the clear shot system but for some reason, the system does not work, it just stays on one virtual camera
    Attached the screenshot of the inspector
     

    Attached Files:

    Last edited: Nov 6, 2020
  2. Mozq8

    Mozq8

    Joined:
    Dec 30, 2016
    Posts:
    61
    Or maybe there is a different solution in Cinemachine?
    I am aware of the Blend List, but it's executing cameras on the specific order, what I need is the system with random virtual cameras
    @Gregoryl maybe you could help me with that, I am bit lost.

    It doesn't have to be a clear shot system, I just chose it because it has a randomized function in it, basically I need a Blend List but with randomized cameras
     
    Last edited: Nov 6, 2020
  3. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Clearshot selects a vcam that has visibility on the target. If there are more vcams with visibility on the target, then clear will pick one and stay with it. Clearshot won't keep switching between them.

    What you'd like to have is a list of vcams from which you randomly select an active vcam in some given interval, right?
    You could make a script that activates a vcam from a list of random vcams at every x seconds.
     
    Mozq8 likes this.
  4. Mozq8

    Mozq8

    Joined:
    Dec 30, 2016
    Posts:
    61
    Thanks for the response.
    So, for instance, I will create some kind of parent gameobject with an array of vcam cameras as a children where I take one camera from random range list, what component do I need to place on parent gameobject so it works with different systems like Blendlist/Clear shot?
     
  5. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    You could do that with Mixing camera. Look at the MixingCamera example scene.

    Cinemachine mixing camera is for mixing different vcams, but in your case, you would not "mix" them. You will just put a weight of 1 for the vcam you'd like active, and 0 to the ones you don't want active.

    Note, you could also achieve what you'd like to do with an empty gameObject which groups your vcams. This empty gameObject would have a script that randomly selects a vcam from its children.
     

    Attached Files:

    Mozq8 likes this.
  6. Mozq8

    Mozq8

    Joined:
    Dec 30, 2016
    Posts:
    61
    Thank you so much for the clarification!
     
  7. Mozq8

    Mozq8

    Joined:
    Dec 30, 2016
    Posts:
    61
    One last question though, if Clear Shot is not designed to switch the virtual cameras - what is the point of such properties as Activate After, Min duration and how to use them properly?
     
  8. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    ClearShot switches virtual cameras, but it switches based on visibility, e.g. if you shoot a ray from the camera to the target, does the ray hit anything before it hits the target.

    Have a look at the ClearShot example scene.
     
    Mozq8 likes this.
  9. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Activate after: when clear shot wants to activate, react after x sec
    Min duration: once you activate a vcam, don't deactive it for at least x sec
     
    Mozq8 likes this.
  10. Mozq8

    Mozq8

    Joined:
    Dec 30, 2016
    Posts:
    61
    Thanks! You guys rock!
     
    gaborkb likes this.