コード例 #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());
     }
 }
コード例 #2
0
 public Vector3 Get()
 {
     return(AccelerometerWithOffset.GetOffsetAccelerometerData());
 }
コード例 #3
0
 /*
  * Move the object
  */
 void Update()
 {
     transform.localPosition = AccelerometerWithOffset.GetOffsetAccelerometerData();
 }