public static async Task <AnchorManagerXR> TryCreate(IPlugin plugin, IHeadPoseTracker headTracker)
        {
            bool xrRunning = await CheckXRRunning();

            if (!xrRunning)
            {
                return(null);
            }

            /// Try to find an XRAnchorManager (to be XRAnchorManager) here.
            /// If we fail that,
            ///     give up.
            /// Else
            ///     pass the manager into AnchorManagerXR for its use.
            XRAnchorSubsystem xrAnchorManager = FindAnchorManager();

            if (xrAnchorManager == null)
            {
                return(null);
            }
            if (!xrAnchorManager.running)
            {
                xrAnchorManager.Start();
            }

            var session = FindSessionSubsystem();

            AnchorManagerXR anchorManager = new AnchorManagerXR(plugin, headTracker, xrAnchorManager, session);

            return(anchorManager);
        }
        public static AnchorManagerXR TryCreate(IPlugin plugin, IHeadPoseTracker headTracker)
        {
            /// Try to find an XRAnchorManager (to be XRAnchorManager) here.
            /// If we fail that,
            ///     give up.
            /// Else
            ///     pass the manager into AnchorManagerXR for its use.
            XRAnchorSubsystem xrAnchorManager = FindAnchorManager();

            if (xrAnchorManager == null)
            {
                return(null);
            }
            if (!xrAnchorManager.running)
            {
                xrAnchorManager.Start();
            }

            var session = FindSessionSubsystem();
            /// mafinc - Currently a problem in OpenXR obtaining the session subsystem.
            /// Everything can function without it, it is only used for detecting loss of tracking.
            //if (session == null)
            //{
            //    return null;
            //}

            AnchorManagerXR anchorManager = new AnchorManagerXR(plugin, headTracker, xrAnchorManager, session);

            return(anchorManager);
        }
Example #3
0
        public void RunningStateTests()
        {
            XRAnchorSubsystem subsystem = CreateTestAnchorSubsystem();

            // Initial state is not running
            Assert.That(subsystem.running == false);

            // After start subsystem is running
            subsystem.Start();
            Assert.That(subsystem.running == true);

            // After start subsystem is running
            subsystem.Stop();
            Assert.That(subsystem.running == false);
        }