I made an AR project using a tutorial I found online with Vuforia sdk. However, I can’t get the Vuforia camera to rotate when the user turns they’re phone, the project completely lacks the AR aspect, the objects don’t stay in the same position while the camera rotates around it just follows it like a normal game. I tried making my own script to rotate the camera with a gyro and ataching it to the ARCamera Object but that did nothing as well
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraGyro : MonoBehaviour {
// The initials orientation
private float initialOrientationX;
private float initialOrientationY;
private float initialOrientationZ;
void Start ()
{
Input.gyro.enabled = true;
// Save the firsts values
initialOrientationX = Input.gyro.rotationRateUnbiased.x;
initialOrientationY = Input.gyro.rotationRateUnbiased.y;
initialOrientationZ = -Input.gyro.rotationRateUnbiased.z;
}
// Update is called once per frame
void Update () {
gameObject.transform.Rotate (initialOrientationX -Input.gyro.rotationRateUnbiased.x, initialOrientationY -Input.gyro.rotationRateUnbiased.y, initialOrientationZ + Input.gyro.rotationRateUnbiased.z);
}
}
I’m surprised I can’t find a solution to this relating to Vuforia, has no one had this problem before? Anyone have any idea how to solve it, I would really appreciate it!