Search Unity

Bug with impulse

Discussion in 'Cinemachine' started by Mars91, Apr 3, 2020.

  1. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
    Hi,
    I'm doing some test with impulse. In my scene I only have one single impulse.
    Calling it is no issue but sometimes after the impulse is played it repeat it self with no real reason. The function is only called once and to be sure I even set amplutude and frequency to 0.

    Code (CSharp):
    1.  
    2.     public CinemachineImpulseDefinition foxImpulse = new CinemachineImpulseDefinition();
    3.  
    4.     public static ImpulseManager instance;
    5.  
    6.  
    7.     void Start()
    8.     {
    9.         instance = this;
    10.     }
    11.  
    12.     private void OnValidate()
    13.     {
    14.         foxImpulse.OnValidate();
    15.     }
    16.  
    17.     public void PlayFoxAttackImpulse()
    18.     {
    19.         foxImpulse.m_AmplitudeGain = 1.0f;
    20.         foxImpulse.m_FrequencyGain = 0.8f;
    21.  
    22.         foxImpulse.CreateEvent(transform.position, Vector3.down);
    23.     }
    24.     public void StopFoxAttackImpulse()
    25.     {
    26.         foxImpulse.m_AmplitudeGain = 0.0f;
    27.         foxImpulse.m_FrequencyGain = 0.0f;
    28.     }
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Can you show the inspector for impulse definition so I can see the settings?

    The duration of the impulse is controlled by the envelope. Changing settings on the source will have no effect on impulses already emitted - it will affect the next impulse emitted.
     
  3. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
    Here's a screen of the impulse.

    Screenshot (283).png
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    That's a very strange envelope, especially the attack. The result should be a tiny double blip lasting less than 0.3s. What is the result that you are seeing? What is the result you are seeking?
     
    Last edited: Apr 4, 2020