cancel
Showing results for 
Search instead for 
Did you mean: 

how to use arcore in hmd

FE_Mason
Honored Guest

To implement AR Tracking on hmd, it is common to use the ARCore library. ARCore is a mobile AR platform developed by Google and can be used on both Android and iOS devices. Oculus also supports the use of ARCore with hmd.

Below is an example Unity code using the ARCore SDK to perform AR Tracking on hmd:

/*

using UnityEngine;

using UnityEngine.XR.ARFoundation;

using UnityEngine.XR.ARCore;

 public class ARTracking : MonoBehaviour

{    [SerializeField] private ARSession arSession;

     void Start()

    {

        if (ARSession.state == ARSessionState.None || ARSession.state == ARSessionState.CheckingAvailability)

        {

            ARSession.stateChanged += OnStateChanged;

        }

        else

        {

            StartTracking();

        }

    }

     private void OnStateChanged(ARSessionStateChangedEventArgs args)

    {

        if (args.state == ARSessionState.SessionInitialized || args.state == ARSessionState.Tracking)

        {

            ARSession.stateChanged -= OnStateChanged;

            StartTracking();

        }

    }

     private void StartTracking()

    {

        var arCoreSession = arSession.subsystem as ARCoreSessionSubsystem;

        if (arCoreSession != null)

        {

            arCoreSession.matchFrameRate = true;

            arCoreSession.enabled = true;

        }

    }

}*/

This code finds the ARSession object and activates AR Tracking using the ARCoreSessionSubsystem. The ARCoreSessionSubsystem is a class provided by the ARCore SDK that offers the necessary features for implementing AR Tracking.

By using this code, AR Tracking can be implemented on hmd. However, if you are using a different AR platform on hmd, you may need to implement AR Tracking differently.

0 REPLIES 0