- Home /
Match Unity camera with iPhone camera
Hi
I am working on an augmented reality game, which has an unity scene as an overlay to the iPhone camera view. What I want to achieve is that when the phone is rotated up with the camera facing the celling or down towards the ground, the unity camera will follow realistically making is look like the object in the scene is where it would be expected.
So far I am unity the iPhone gyroscope for the rotation.
newAngles.x += (Input.gyro.rotationRate.y * (180 / Mathf.PI)) * Time.deltaTime;
However the rotation gets offset after a while due to the relative calculation of the rotation. What would be the best way to recalibrate the gyroscope?
I tried to experiment with the attitude of the gyroscope. It gives a quaternion which I cant assign directly to the camera angles as the values seem a bit strange to me. As far as I know the values are suppose to be the yaw, pitch and roll. But it seems like some of the angles are dependent on each other. For instance when rotating around the X axis the value of the Y rotation suddenly switches so its inverted. Im not sure why this happens?
Answer by Mish · Mar 21, 2012 at 12:44 PM
Found my answer here:
http://forum.unity3d.com/threads/128493-Match-Unity-camera-with-iPhone-camera?p=869066#post869066
Your answer
Follow this Question
Related Questions
Using a wireless camera with iPhone/Android 0 Answers
How would I go about making a cube "tumble" off of corners and such? 2 Answers
[Mobile AR] Model faces away from camera? 0 Answers
Vuforia AR cant see the object on tracker. 0 Answers
How to set child position and rotation fixed respect parent? 0 Answers