Search Unity

Question 2D Freeform Lights and Camera Shake problem

Discussion in '2D' started by Rossakis, Aug 29, 2023.

  1. Rossakis

    Rossakis

    Joined:
    Sep 5, 2018
    Posts:
    6
    Hello everyone!

    I'm currently using Unity 2022.3.7f1 and have created a script that alters the variable
    CinemachineBasicMultiChannelPerlin.m_AmplitudeGain of my virtual Cinemachine camera in order to create a camera-shaking effect, by Lerping the m_AmplitudeGain by a set amount of intensity and time.

    However, the 2D Lights in my scene (Freeform Light type), shake along with the camera, while my 2D Light of Spot Light type does not.

    Is there a way to make the Freeform light stay in place during the camera shake?
     

    Attached Files:

  2. Rossakis

    Rossakis

    Joined:
    Sep 5, 2018
    Posts:
    6
    Anyway, I found the solution. For some reason, the problem arose with the old gameObject that contained the Freeform lights and once I created new ones with the same component, the camera shake problem was resolved somehow.

    EDIT: I found out that the real reason for this behavior was due to the lighting having a ridiculously high value on the z-axis (900+), and when I reset it back to zero, it started behaving as intended, aka being stationary when the camera shook.
     
    Last edited: Sep 1, 2023
    MaxwellTan likes this.