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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question Camera shake

Discussion in 'Cinemachine' started by JustBelieve7, Feb 6, 2021.

  1. JustBelieve7

    JustBelieve7

    Joined:
    Jan 2, 2021
    Posts:
    2
    Hi,

    I am using Cinemachine to shake screen on collision and I have a problem with Main Camera rotation after shaking the screen - screen shake also changes randomly rotation in X, Y and Z-directions, which I do not want.
    Cinemachine Camera is attached to the Main Camera:
    upload_2021-2-6_16-45-52.png
    Then Cinema Impulse listener is applied to Cinemachine Camera:
    upload_2021-2-6_16-46-26.png
    An object which introduces shakes has Cinemachine Collision Impulse Source script:
    upload_2021-2-6_16-46-43.png

    Does anyone had the same issue or knows how to reset rotation after shaking?
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Hi,

    Don't parent your vcam under your Main Camera, because the vcam is changing the Main Camera's transform. But because the vcam is a child of the Main Camera, the vcam's transform is changing when the Main Camera's transform changes. It's a dog chasing its tail kind of situation. :)


    If you'd prefer to apply rotational shake to your camera, then create a Noise Setting with no rotational noise. To create a new Noise Setting, click on the Gear Icon next to Raw Signal on your Cinemachine Impulse Source (see the attached image - NewNoiseSetting). Then open the newly created Noise Setting and leave the rotational parts empty; only create positional noise (see the attached image - PositionalNoise).
     

    Attached Files:

    Last edited: Feb 8, 2021
    Gregoryl and JustBelieve7 like this.
  3. JustBelieve7

    JustBelieve7

    Joined:
    Jan 2, 2021
    Posts:
    2
    Thanks! As you mentioned, just placing Cinemachine Camera at the top level and not as a child object under Main Camera fixed this. Even though rotation is still applied, Main Camera rotation resets after impulse is finished. The second part is also quite useful since it gives more control to the impulse source.
     
    gaborkb likes this.