Example usage for com.badlogic.gdx Input getAccelerometerX

List of usage examples for com.badlogic.gdx Input getAccelerometerX

Introduction

In this page you can find the example usage for com.badlogic.gdx Input getAccelerometerX.

Prototype

public float getAccelerometerX();

Source Link

Usage

From source file:com.digitale.screens.GameLoop.java

License:Open Source License

/**
 * @param input//from  w ww  .  j ava2  s  . c o m
 */
public void accellerometer(Input input) {
    // accelerometer
    if (input.getAccelerometerY() < -Stardust3d.deadzoneX || input.getAccelerometerY() > Stardust3d.deadzoneX)
        Ship.yawAngle -= (input.getAccelerometerY() * Stardust3d.accelXsensitivity);

    if (input.getAccelerometerX() < 4 - Stardust3d.deadzoneY) {
        Ship.pitchAngle -= Math.abs(input.getAccelerometerX() - (4 - Stardust3d.deadzoneY))
                * Stardust3d.accelYsensitivity;
    } else if (input.getAccelerometerX() > 5 + Stardust3d.deadzoneY) {
        Ship.pitchAngle += Math.abs(input.getAccelerometerX() - (5 + Stardust3d.deadzoneY))
                * Stardust3d.accelYsensitivity;
    }
}