Can Unity determine the direction an Android device is heading?
We are looking to develop an Android/iPhone augmented reality project, and are currently trying to decide whether to use Unity or Shiva to develop it. I found that the compass is easily read with Shiva in this simple call:
http://www.stonetrip.com/developer/doc/api/system-getLastKnownHeading
I was hoping that it would be this simple with Unity, but so far I can find little information on sensor based augmented reality with Unity.
We were hoping to match a camera in the virtual world, to the rotation/tilt of the device, using the accelerometer and compass, combined with gps for camera position in the game world. The idea is to allow users to walk around an object placed at certain gps co ordinates, and see a 3d object overlaid on the camera video feed - so it looks like the 3d object is in the world in front of the user, who can explore it from different angles by walking around in the real world and looking through the android device.
So far the GPS access is helpful in positioning the camera, but without knowing the device’s direction we have no way to point the camera in the right place.
I was also wondering how to match the camera’s rotation to the accelerometer data (for looking up/down the object) - if anyone could provide information on this it would also be helpful,
If you think that getting the compass heading and using the accelerometer to rotate the camera are impossible to do with Unity for Android please let me know - we haven’t decided if we will use Unity or Shiva yet for the project, and still have some trial time left to decide which one would be more convenient to develop with.
Any help appreciated.