I am trying to smooth out accelerometer input and using lerp or slerp like this:
Code:
cam.transform.position = Vector3.Lerp(cam.transform.position, newcamPos, 0.018f);
The camera position is being controled by the accelerometer change * 420 or so to amplify the movement. I need to keep the movement clamped to the accelerometer – so a tilting the device pans up to the max accel input and when tilted back to the starting point unpans to the original camera position.
When the accelerometer input is bouncing between 0 and 0.018 (which it always does sitting still), Lerp or Slerp both work well to get the jitter out. But when the accelerometer input is bouncing between 0.7 to 0.718 Lerp/Slerp seem to do nearly nothing. I don’t understand why? Obviously I am missing something. My goal is to smooth out the ‘jitter’ caused by accelerometer bouncing around ± 0.18 regardless of its position.