Ar foundation + Oculus quest2 Is it available in Unity?

661 views Asked by At

I want to use the Oculus quest2, not a mobile phone, and use the AR foundation package in Unity. Is this possible?

I attached AR foundatiom scripts to OVRcameraRig and only passthrough works. I want to use image tracking function.

2

There are 2 answers

0
Mattia Pompita On

I try it too, but I have the same issue. I noticed in my console log there are 2 warning:

"No active UnityEngine.XR.ARSubsystems.XRSessionSubsystem is available."

"No active UnityEngine.XR.ARSubsystems.XRCameraSubsystem is available."

Like AR Foundation don't support Oculus so it can't initialize the XR Session.

0
Majd Alghaddaf On

To answer the original post, yes, it is possible to use AR Foundation with Oculus Quest devices, but functionalities are very limited.

You would need to target OpenXR as runtime, and that restricts you to 4 features: Session, Device Tracking, Anchors, and Meshing. Image Tracking is not supported when building for OpenXR. See here under "Platform Support".

However, on a recent Unity talk, they mentioned bringing Oculus support to AR Foundation, so guess we'll have to wait for that.

To answer @Mattia Pompita's comment, you just need to activate the subsystem yourself. You can do this in the following way:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.XR;
using UnityEngine.XR;

public class Display : MonoBehaviour
{
    public string match = "Display0";

    // Use this for initialization
    void Start ()
    {
        List<XRDisplaySubsystemDescriptor> displays = new List<XRDisplaySubsystemDescriptor>();
        SubsystemManager.GetSubsystemDescriptors(displays);
        Debug.Log("Number of display providers found: " + displays.Count);

        foreach (var d in displays)
        {
            Debug.Log("Scanning display id: " + d.id);

            if (d.id.Contains(match))
            {
                Debug.Log("Creating display " + d.id);
                XRDisplaySubsystem dispInst = d.Create();

                if (dispInst != null)
                {
                    Debug.Log("Starting display " + d.id);
                    dispInst.Start();
                }
            }
        }
    }
}

You would need to replace "Display0" with the name of the subsystem you wish to activate. "oculus" should work fine.

Check this for more info.