Search Unity

Cinemachine and Screen Shake.

Discussion in 'Timeline' started by WizByteGames, Jul 18, 2017.

  1. WizByteGames

    WizByteGames

    Joined:
    Mar 28, 2013
    Posts:
    36
    I was wondering is it possible to do screen shake with Cinemachine?
     
  2. JakubSmaga

    JakubSmaga

    Joined:
    Aug 5, 2015
    Posts:
    416
    Have you tried using Noise?
     
  3. WizByteGames

    WizByteGames

    Joined:
    Mar 28, 2013
    Posts:
    36
    No I haven't tried using noise. I can give it a try and let you know how it works out. I didn't think about using Noise because I thought that would only give me a smooth moving motion.

    Edit: Adding noise did the trick. So basically I would assume you would have 2 virtual cameras in your scene one for following your character and one that follows your character with noise enabled. Then just switch between them when needed.
     
    Last edited: Jul 18, 2017
  4. JakubSmaga

    JakubSmaga

    Joined:
    Aug 5, 2015
    Posts:
    416
    Since Cinemachine 2.0 API is really big and open you could just use this second "technique".
    Just create your Noise asset and add it through the script when you need to use it; instead of using 2 virtual cameras, then after shake stops just use "CurrentNoise = null;".

    (It will make your hierarchy clearer and also your performance should be better)

    Update: I was looking at their documentation page and looks that you just need to change CinemachineVirtualCamera.CurrentNoise and it should work.

    Also remember to create your future posts about Cinemachine in the Cinemachine subforum! :)
    https://forum.unity3d.com/forums/cinemachine.136/
     
    Last edited: Jul 18, 2017