- Home /
 
Starting position gyroscope camera unity
I have a 360 video inside a sphere in my unity scene, and I'm using a gyro script so the user can rotate around and watch the movie, the problem is there is a person in the movie and I want the camera to start at the person's position, not the mobile's position, but with my code I can only assign my giroscope position to my camera, if I want the camera to start from precise position, I need to add/substract the difference from the last frame and the current frame to the current position, but how can I do that?
 public class Gyro : MonoBehaviour {
 
 
     void Start()
     {
         if (SystemInfo.supportsGyroscope)
         {
             Input.gyro.enabled = true;
         }
 
 
             GameObject cameraParent = new GameObject("camParent");
             cameraParent.transform.position = this.transform.position;
             this.transform.parent = cameraParent.transform;
             cameraParent.transform.Rotate(Vector3.right, 90);
 
     }
 
 
     void Update()
     {
 
 
             Quaternion cameraRotation = new Quaternion(Input.gyro.attitude.x, Input.gyro.attitude.y,
 -Input.gyro.attitude.z, -Input.gyro.attitude.w);
             this.transform.localRotation = cameraRotation;
 
 
     } }
 
              Your answer
 
             Follow this Question
Related Questions
Get camera rotation constrained to left/right (ie. yaw)? 2 Answers
VR camera position instant flick 0 Answers
"Moving" skybox closer, to emulate a smaller room? (VR 360 degree app) 2 Answers
Rotating a camera using the gyroscope 4 Answers
How can I make the camera rotate with gyroscope appropriately? 1 Answer