Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice
  2. We've opened up a space to discuss, share feedback, and showcase everything related to the Unity Shader Graph! Come show us what you've made.
    Dismiss Notice

Cinemachine Shake con 2D Camera

Discussion in 'Cinemachine' started by DavidAvenue, Sep 10, 2018.

  1. DavidAvenue


    Dec 27, 2016

    Is ImpulseListener the best way to achieve 2D shakes? Wanted to achieve things like recoils and 'quakes', but haven't been able to achieve so pretty well, so I guess my other question would be: what's the best resource to learn how to use impulse listeners?

    I'm gonna be needing to do the shake calls through code as well.

    Any help is greatly appreciated.
  2. Gregoryl


    Unity Technologies

    Dec 22, 2016
    For a 2D shake, just define a signal which is static in the Z direction. You can take one of the sample signals, say the 6D shake, clone it, and delete the Z axis channels.

    Look at the Impulse scene in the Cinemachine Examples. This is a good place to see how Impulse is used.

    You can generate impulses from code very easily. CinemachineImpulseSource is a good starting point. It's very simple, and you can see in there exactly how the impulse is generated. Just do the same thing from your own scripts. CinemachineCollisionImpulseSource is an example of a script that inherits from CinemachineImpulseSource, and generates impulses when it detects interaction with a Collider. Your own script can generate impulses in response to whatever you like.