I want to rotate an object with respect to the phone’s position. I use the accelerometer output to detect orientation:
float roll = Gdx.input.getRoll();
float pitch = Gdx.input.getPitch();
float azimuth = Gdx.input.getAzimuth();
Vector3 accel=new Vector3(accelX, accelY, accelZ);
bat.transform.setToRotation(0f, -1f, 0f, pitch);
bat.transform.setFromEulerAngles(azimuth, -pitch, -roll);
However, the accelerometer data fluctuates so strongly that the object jitters.
How can I deal with this?