Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Best or standard way for camera shake with multiple room/level confiners, using impulses?

Discussion in 'Cinemachine' started by DearUnityPleaseAddSerializableDictionaries, Jun 5, 2022.

  1. DearUnityPleaseAddSerializableDictionaries

    DearUnityPleaseAddSerializableDictionaries

    Joined:
    Sep 12, 2014
    Posts:
    135
    Based on my limited understanding of Cinemachine, is this the standard way to have camera shake (bullet shoot or take damage) on rooms/levels with multiple confiners?

    1. Each room/level will have its own virtual camera that has its own confiner extension, that listens to an impulse. To avoid duplication (e.g. of Dead Zone settings), I'll have to use a prefab.
    2. Every time the player takes damage or shoots, it fires a camera shake impulse.
    Because I wanted to try see if it was possible having one single virtual camera and replacing the "bounds" in the confiner extension, but replacing the bounds or unsetting the bounds (i.e. setting it to null) causes the camera to "jump/teleport" instantaneously. Because I can't have a single camera, the only way I can make the camera shake consistently is to configure every virtual camera to listen to impulses?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    Yes, you can add the impulse listener to each vcam.
    There is no advantage to doing everything with a single vcam.
    Why not make a prefab for the vcam, and just override the confiner bounds field in each instance?

    Alternatively, instead of an ImpulseListener extension on the vcams, you can add a CinemachineIndependentImpulseListener to the main camera.
     
  3. DearUnityPleaseAddSerializableDictionaries

    DearUnityPleaseAddSerializableDictionaries

    Joined:
    Sep 12, 2014
    Posts:
    135
    Thank you, makes sense.

    Cinemachine has been very helpful and fast to learn. I have now used impulses a lot and they are very helpful (though I also used the legacy ones).