Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Cinemachine Shake con 2D Camera

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

  1. DavidAvenue

    DavidAvenue

    Joined:
    Dec 27, 2016
    Posts:
    5
    Hi,

    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

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,731
    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.