Exemplo n.º 1
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());
     }
 }
 public Vector3 Get()
 {
     return(AccelerometerWithOffset.GetOffsetAccelerometerData());
 }
 /*
  * Move the object
  */
 void Update()
 {
     transform.localPosition = AccelerometerWithOffset.GetOffsetAccelerometerData();
 }