Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Questions about Impulses

Discussion in 'Cinemachine' started by slgremory, Oct 3, 2020.

  1. slgremory

    slgremory

    Joined:
    Jan 5, 2019
    Posts:
    5
    Howdy, I just had a question about how best to approach a particular task using Cinemachine's Impulse Sources and Listeners.

    I have a Source + Listener system working great! However, it seems the best I can do is pass in a magnitude (vector 3) to determine how strong an impulse it should be. I'd like to also be able to dictate the amount of time/decay that an impulse has when calling GenerateImpulse().

    Is there a way to accomplish this? Thank you for your time and assistance!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,238
    This option will do it to some extent, but at the moment there is no explicit fine-grained control over that.

    upload_2020-10-2_19-39-43.png

    Alternatively, you could write a little script that exposes an API that takes a time parameter, and scales the appropriate fields in the source before generating the impulse.
     
  3. slgremory

    slgremory

    Joined:
    Jan 5, 2019
    Posts:
    5
    The second option sounds like it's more up my alley. I'm a bit new to working with external APIs, so I went looking around in the CM version 2.3 API online and found the "Class CinemachineImpulseDefinition" > "Field m_TimeEnvelope", with the struct EnvelopeDefintion that contains m_SustainTime and m_DelayTime. I'm thinking these are the two I would want access to, am I correct?
     
    Gregoryl likes this.
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,238
    Indeed you are correct. If you're using CM 2.3 then you should consider upgrading. The current version is 2.6.3.
     
  5. slgremory

    slgremory

    Joined:
    Jan 5, 2019
    Posts:
    5
    I mistyped, I forgot the middle '.6' :)

    I'll see if I can figure out how to interface with those. Never tried exposing API properties before lol
     
  6. toxejep219

    toxejep219

    Joined:
    Oct 12, 2020
    Posts:
    2
    Following