Search Unity

Camera Shake based on transform location

Discussion in 'Cinemachine' started by Korindian, Jun 30, 2019.

  1. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    Hi, I'm really liking the camera shaking system that Cinemachine has, but I find that I'm not able to create a camera shake whose location can be updated with infinite sustain.

    For example, with engines on a spacecraft, if I use m_HoldForever = true, it will shake forever, but only at the position at which the impulse definition created the event. If the spacecraft moves, the shake source is at the original event position, and doesn't move with the spacecraft.

    It would be great if there were an API where we can pass in a transform so that the source location can be updated, in case the camera shake source objects move.

    Is this already possible somehow?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    I wouldn't use HoldForever. Could you instead just keep emitting short overlapping bursts of signal?
     
    Korindian likes this.
  3. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    After some tweaking, for fast spacecraft, I tried firing a shake 10 times a second but with overlapping attacks/decays, and it seems to look fairly consistent. Should hold forever not be used in general, or do you mean for this use case?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    I meant for this use case. If you want to use it, you need to keep a handle to the noise event, and delete it eventually.
     
    Korindian likes this.