Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Confiner & Impulse Listener don't play nice together?

Discussion in 'Cinemachine' started by Meatloaf4, Jul 27, 2020.

  1. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    76
    Currently my game makes extensive use of the Cinemachine Confiner (with some custom adjustments for perspective mode). I'm noticing though that when I use it along with a cinemachine impulse source / listener I believe the confiner messes with the impulse as I believe the confiner is trying to adjust the camera bounds back to normal while the impulse is occurring.

    I'm wondering if what i'm seeing makes some sense or if i'm maybe just going a little crazy from staring at camera shakes for too long haha.

    Thanks in advance!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    3,953
    Can you show an example of what you are seeing?
     
  3. CDGKen

    CDGKen

    Joined:
    Jun 28, 2019
    Posts:
    24
    Hello,

    I'm wondering if I can chime in this thread with an issue I'm experiencing that may be related. I'm working on a 2D game using an orthographic camera, using a vcam with a confiner with 0 damping. I was looking to do some very simple camera shake and used the CinemachineBasicMultiChannelPerlin 2DCameraShake noise profile to accomplish this. It worked well, however with the recent update to v2.6.0 of Cinemachine, it looks like the confiner now overrides the perlin noise, and confines the shake when the camera hits the confiner edge. To verify this behaviour, I tested on v2.5.0 and the camera shake works again.

    I figured maybe I should use impulse instead, so I set it up and got similar behaviour (although I admittedly may have set it up incorrectly since it's a bit more complicated to use).

    I understand if this is intended behaviour, but I'm wondering if there is a way to get camera shaking to work with confiners. One way "around" it was to allow the confiner to dampen a little whenever a camera shake was active, but it produced an undesired result if the shake occurred while the camera was also moving (for ex. moving left/right during the camera shake would make the camera shift left/right a lot, resulting in a bad looking camera shake).

    Thanks for the help,

    Kenny
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    3,953
    @CDGKen Thanks for that description. It sounds like a script execution order issue. Script execution order is undefined or scripts in the "default" category, and most of the CM extensions fall into that category. Can you try setting the execution order for CinemachineConfiner to be earlier than default? The info is stored in the metafile of the script which is part of the CM package, so you will have to modify the package to test this out.
     
  5. CDGKen

    CDGKen

    Joined:
    Jun 28, 2019
    Posts:
    24
    Thanks for helping look into this.

    Unfortunately changing the script execution order of Cinemachine.CinemachineConfiner does not seem to change anything. (I changed the order via the meta file in the package folder as you suggested since adding it via Script Execution Order in the Project Settings would not make the change stick).

    scriptexecution.jpg

    I changed it to just before default, and well before default, but had the same result. In a hail mary attempt I tried moving the confiner script above the virtual camera script on the component but that didn't work either.
     
    Last edited: Aug 3, 2020 at 5:15 PM
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    3,953
    I had a look at the code and it turns out that yes there was a change in 2.6.0 that produces this result, and changing the execution order won't help. We'll look into correcting this for 2.6.1.
     
  7. CDGKen

    CDGKen

    Joined:
    Jun 28, 2019
    Posts:
    24
    Thanks for looking into it.

    I'm sorry for asking this, but assuming it's not a big code change, would it be possible to get a suggested fix I could apply on the Cinemachine package on my end? We're planning on launching our game in two weeks, and it would be great if we could have a fix for this, however unofficial it is.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    3,953
  9. CDGKen

    CDGKen

    Joined:
    Jun 28, 2019
    Posts:
    24
    Oh wow, that's terrific. I'll keep my eye out for the preview. Thanks so much!
     
unityunity