Search Unity

  1. Unity 2019.1 beta is now available.
    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. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Cinemachine Impulse Listener on player object?

Discussion in 'Cinemachine' started by zt3ff3n, Jul 4, 2018.

  1. zt3ff3n

    zt3ff3n

    Joined:
    Feb 19, 2016
    Posts:
    15
    I'm using the freelook rig as a mainly top-down camera looking at my player-object from a higher Y-axis offset.
    I'd still like it to shake whenever the player shoots, is close to an explosion etc. I can only seem to attach the Impulse Listener onto the virtual camera, which makes it shake if the camera is close to an explosion etc. How do I go about controlling the shake with the magnitude an all that lovely juice - only based impulses near the player-object?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,066
    You can do it very easily with a custom impulse Listener.

    Find CinemachineImpulseListener.cs, copy it into your Assets folder, and rename it to ImpulseListenerAtTarget, or something like that. Rename the class name to match.

    Then, look inside where it calls CinemachineImpulseManager.Instance.GetImpulseAt(), and instead of passing it State.FinalPosition as the listener location, change it to pass it the player's position. Use the new extension in place of CinemachineImpulseListener, and you will get the behaviour you're looking for.
     
  3. zt3ff3n

    zt3ff3n

    Joined:
    Feb 19, 2016
    Posts:
    15
    Thanks Greg!