So I've tried the vector rotation sensor using the Android API and it works perfectly to do what I want, but LibGDX does not support this sensor. I've been searching and it seems like I can do the same thing as vector rotation sensor using the accelerometer and compass values returned by LibGDX API:
Gdx.input.getAccelerometerX();
Gdx.input.getAccelerometerY();
Gdx.input.getAccelerometerZ();
Gdx.input.getAzimuth();
Gdx.input.getPitch();
Gdx.input.getRoll();
But I couldn't find out how to do this.