Acceleration from device’s coordinate system into absolute coordinate system

I finally managed to solve it! So to get acceleration vector in Earth’s coordinate system you need to: get rotation matrix (float[16] so it could be used later by android.opengl.Matrix class) from SensorManager.getRotationMatrix() (using SENSOR.TYPE_GRAVITY and SENSOR.TYPE_MAGNETIC_FIELD sensors values as parameters), use android.opengl.Matrix.invertM() on the rotation matrix to invert it (not transpose!), use Sensor.TYPE_LINEAR_ACCELERATION sensor … Read more

Changing the Coordinate System in LibGDX (Java)

If you use a Camera (which you should) changing the coordinate system is pretty simple: camera= new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); If you use TextureRegions and/or a TextureAtlas, all you need to do in addition to that is call region.flip(false, true). The reasons we use y-up by default (which you can easily change as … Read more

How do android screen coordinates work?

This image presents both orientation(Landscape/Portrait) To get MaxX and MaxY, read on. For Android device screen coordinates, below concept will work. Display mdisp = getWindowManager().getDefaultDisplay(); Point mdispSize = new Point(); mdisp.getSize(mdispSize); int maxX = mdispSize.x; int maxY = mdispSize.y; EDIT:- ** **for devices supporting android api level older than 13. Can use below code. Display … Read more