- Home /
How to create a camera that is controlled by a mobile device's in built sensors?
I'm thinking of something along the lines of Motorola's "augmented reality" animation "Windy Day" where users have to move their phones around in order to follow the action of the story (full 360 degree rotation in all directions). How would one go about creating such a camera in Unity? Even better would be combining the device's gyro sensor and accelerometer to allow people to "step" through the space as well. Any code snippets, tutorials, or resources are very much appreciated.
Thanks!
Answer by tanoshimi · Sep 30, 2014 at 06:14 PM
Fortunately, Unity makes this trivial. You can read the gyroscope with Input.gyro, and the accelerometer with Input.acceleration. You can also read the device orientation. Then just apply the values to the transform component of your camera.
Oh wow, thanks for the response. It does seem trivial. What are the limitations? For example can one sensor or the other sense/track my movement from one side of the room to the other? Or is it strictly limited to rotation?
Your answer
Follow this Question
Related Questions
How do I access the Accelerometer and Gyroscope on my Surface Pro? 2 Answers
Help requested: Google VR / Phone rotation to gameobject. 1 Answer
Jet Accelerometer Script 1 Answer
How to get highest value for acceleration from Input.gyro 0 Answers
Detect car acceleration with device motion sensors and GPS 0 Answers