Search Unity

Feedback Cinemachine Collider : Multiple Obstacle Resolutions

Discussion in 'Cinemachine' started by CaseyHofland, Feb 7, 2022.

  1. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    613
    Hi there! We are looking for some specific behavior with the Cinemachine Collider. We want it to immediately respond when the player is obscured, but smooth in when the player is "in danger of being obscured".

    A.K.A. multiple obstacle resolutions.

    Cinemachine Collider.png

    I tried implementing this on my own but Cinemachine quickly proved to be a spiderweb of code and rules that, well, simply wasn't worth it for our game (while I have the opportunity to say this, I am super impressed and happy for everything Cinemachine has done and continues to do for me).

    Nevertheless, I thought it would be a cool feature. The idea was actually inspired by Breath of the Wilds camera, so you can even get away with playing Zelda in the name of 'research' :D.
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Hi

    It is not possible with the base Cinemachine Collider. You could write your own Cinemachine Collider though, that does this.

    An idea, that may work :)
    Copy the CinemachineCollider script and modify it to have two camera radiuses: one radius r for immediate response, and one radius R for smooth response. r should be smaller than R.
    - If an obstacle hits sphere with radius r, then you respond immediately -> no damping.
    - Else if an obstacle hits sphere with radius R, then you respond smoothly -> some damping.

    Basically, you'd be combining these two cases:
    Immediate:
    Immediate.png
    Smooth:
    Smooth.png


    I watched a couple of gameplay videos, but I could not find the camera behaviour you describe. :eek:
     
    Kirsche likes this.