Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float accX = Gdx.input.getAccelerometerX(),
- accY = Gdx.input.getAccelerometerY(),
- accZ = Gdx.input.getAccelerometerZ();
- float moduleValue = (float) Math.sqrt(accX * accX + accY * accY + accZ * accZ);
- //Here I do the gravity compensation
- accX /= moduleValue;
- accY /= moduleValue;
- accZ /= moduleValue;
- float xRotation = (float) Math.atan2(accY, accZ) * MathUtils.radiansToDegrees,
- zRotation = (float) Math.atan2(accY, accX) * MathUtils.radiansToDegrees;
Add Comment
Please, Sign In to add comment