Detecting a users movement and speed in real life for Augmented reality game

I am looking for the suggestions on what’s the best way to detect a users movement and speed in real life so I can accurately move them around in my augmented reality game.

Windows Phone provides a Motion class that makes use of the compass, gyro and accelerometer sensors to achieve this but I don’t see any just library available for Unity. My guess is the math is pretty complex to achieve this.

Does anyone know of any libraries that support this in Unity for Android and iPhone?


I don’t know much about that Motion class. I briefly peeked at the documentation and it seems it gives you sensor data from your phone. You can get the same data from Unity’s API directly.

For GPS / Location, use the LocationService class. You can get latitude, longitude and altitude
For the magnetic compass, use the Compass class.
For the accelerometer data, use Input.acceleration

These three should give you the same data as that Motion class and they’re cross platform, as long as they are supported by the device.