Google Cardboard - 360 Viewer with the real world North Pole

Hi,

I need help to create an application with a 360 viewer on Google Carboard.
My starter kit is simple: 1 sphere with my panoramic texture, 1 camera inside the sphere.
I can turn inside.

My problem :
When i create an apk and i play it, i appear in my sphere, i’m always in the same direction. For exemple, i watch a house.

But I want :
My sphere oriented in the real North Pole (terrestrial) and when i play my apk, no matter where I look, the sphere position is the same, locked in north.
Like this, no matter wher i look in the Cardboard, and no matter when and wher i play my apk, the environment is always in the same position.

I hope that’s is clear… it’s complicated to explain.:frowning:

I tried to use -trueHeading and -magneticHeading from the Compass Script APi, but without success…:frowning:

Thank in advance :slight_smile:

Hi,

Does your device have a gyro?

Hi 

I think that yes, it’s a Redmi Note 8 Pro.

Ok, so the headset tracking is working? And the next step is to align the sphere with the true north pole?

Maybe this will do it:

Hello there! As Google Cardboard is no longer directly supported by Unity, you might also ask over on Google’s Github here.

Ok thanks :slight_smile:

I find this script, and when i start in different position, it’s good, my north is always on the same position !! :smile:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class newway : MonoBehaviour
{
 
    GameObject cam;
    void Start()
    {
       
        cam = Camera.main.gameObject;
        Input.location.Start();
        Input.compass.enabled = true;
    }

    void Update()
    {
       
        Quaternion cameraRotation = Quaternion.Euler(0, cam.transform.rotation.eulerAngles.y, 0);
        Quaternion compass = Quaternion.Euler(0, -Input.compass.magneticHeading, 0);

        Quaternion north = Quaternion.Euler(0, cameraRotation.eulerAngles.y + compass.eulerAngles.y, 0);
        transform.rotation = north;
    }

}

My new problem, the view shakes because the compass isn’t extremly says.
How i can do to smooth degrees ? Have you an idea ?
I’ve read that we can use “Quaternion.Lerp” or “Quaternion.RotateTowards”… but in my situation, it’s complicated with the “-Input.compass.magneticHeading”…

Thanks a lot ! :sweat_smile:

Perhaps you don’t have to correct the rotation on each frame?
Once it set, the VR gyro should keep track of the environment relative the head.