Beispiel #1
0
    /*
     * If in auto-update, the function just assigns current filtered value to local position.
     * Otherwise it inputs the current mouse position to the filter and then assigns filtered value to local position.
     */
    void Update()
    {
        if (shouldUseComponent)
        {
            if (a != Parameters.a)
            {
                a = Parameters.a;
                mouseControl.SetA(a);
            }

            transform.localPosition = mouseControl.Get();
        }
        else
        {
            if (a != Parameters.a)
            {
                a = Parameters.a;
                lowPassFilter.A = a;
            }

            lowPassFilter.Append(MousePositionWithOffset.GetOffsetMousePosition());
            transform.localPosition = lowPassFilter.Get();
            // or simply:
            // transform.localPosition = lowPassFilter.Append(MousePositionWithOffset.GetOffsetMousePosition());
        }
    }
Beispiel #2
0
 /*
  * If in auto-update, the function just assigns current filtered value to local position.
  * Otherwise it inputs the current value to the filter and then assigns filtered value to local position.
  */
 void Update()
 {
     if (shouldUseComponent)
     {
         transform.localPosition = accelerometerControl.Get();
     }
     else
     {
         lowPassFilter.Append(AccelerometerWithOffset.GetOffsetAccelerometerData());
         transform.localPosition = lowPassFilter.Get();
         // or simply:
         // transform.localPosition = lowPassFilter.Append(AccelerometerWithOffset.GetOffsetAccelerometerData());
     }
 }
 /*
  * This is the getter for the current filtered value.
  * It returns value from the filter.
  */
 public T Get()
 {
     return(lowPassFilter.Get());
 }