Exemplo n.º 1
0
        void InitializeARKit(serializableARKitInit sai)
        {
                        #if !UNITY_EDITOR
            //get the config and runoption from editor and use them to initialize arkit on device
            //added Sascha Gehlich's modifications to this method bc this seemed to help with the framerate issues
            Application.targetFrameRate = 60;
            m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
            ARKitWorldTrackingSessionConfiguration config = sai.config;
            UnityARSessionRunOption runOptions            = sai.runOption;

            UnityARSessionNativeInterface session = UnityARSessionNativeInterface.GetARSessionNativeInterface();

            config.planeDetection = UnityARPlaneDetection.Horizontal;
            var videoFormat = UnityARVideoFormat.SupportedVideoFormats()[UnityARVideoFormat.SupportedVideoFormats().Count - 1];
            config.videoFormat          = videoFormat.videoFormatPtr;
            Application.targetFrameRate = videoFormat.framesPerSecond;

            m_session.RunWithConfigAndOptions(config, runOptions);

            UnityARSessionNativeInterface.ARFrameUpdatedEvent  += ARFrameUpdated;
            UnityARSessionNativeInterface.ARAnchorAddedEvent   += ARAnchorAdded;
            UnityARSessionNativeInterface.ARAnchorUpdatedEvent += ARAnchorUpdated;
            UnityARSessionNativeInterface.ARAnchorRemovedEvent += ARAnchorRemoved;
                        #endif
        }
Exemplo n.º 2
0
        void InitializeARKit(serializableARKitInit sai)
        {
            //#if !UNITY_EDITOR

            //get the config and runoption from editor and use them to initialize arkit on device
            Application.targetFrameRate = 60;
            m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
            ARKitWorldTrackingSessionConfiguration config = sai.config;

            if (detectionImages != null)
            {
                config.arResourceGroupName = detectionImages.resourceGroupName;
            }

            UnityARSessionRunOption runOptions = sai.runOption;

            m_session.RunWithConfigAndOptions(config, runOptions);

            UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated;
            //UnityARSessionNativeInterface.ARAnchorAddedEvent += ARAnchorAdded;
            //UnityARSessionNativeInterface.ARAnchorUpdatedEvent += ARAnchorUpdated;
            //UnityARSessionNativeInterface.ARAnchorRemovedEvent += ARAnchorRemoved;

            //#endif
        }
Exemplo n.º 3
0
        private void InitializeARKit(serializableARKitInit sai)
        {
            Application.targetFrameRate = 60;
            m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
            ARKitWorldTrackingSessionConfiguration config = sai.config;
            UnityARSessionRunOption runOption             = sai.runOption;

            m_session.RunWithConfigAndOptions(config, runOption);
            UnityARSessionNativeInterface.ARFrameUpdatedEvent  += ARFrameUpdated;
            UnityARSessionNativeInterface.ARAnchorAddedEvent   += ARAnchorAdded;
            UnityARSessionNativeInterface.ARAnchorUpdatedEvent += ARAnchorUpdated;
            UnityARSessionNativeInterface.ARAnchorRemovedEvent += ARAnchorRemoved;
        }
Exemplo n.º 4
0
        void InitializeARKitFaceTracking(serializableARKitInit sai)
        {
#if !UNITY_EDITOR
            //get the config and runoption from editor and use them to initialize arkit for facetracking on device
            Application.targetFrameRate = 60;
            m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
            ARKitFaceTrackingConfiguration config     = sai.config;
            UnityARSessionRunOption        runOptions = sai.runOption;
            m_session.RunWithConfigAndOptions(config, runOptions);
            UnityARSessionNativeInterface.ARFrameUpdatedEvent      += ARFrameUpdated;
            UnityARSessionNativeInterface.ARFaceAnchorAddedEvent   += ARFaceAnchorAdded;
            UnityARSessionNativeInterface.ARFaceAnchorUpdatedEvent += ARFaceAnchorUpdated;
            UnityARSessionNativeInterface.ARFaceAnchorRemovedEvent += ARFaceAnchorRemoved;
#endif
        }
Exemplo n.º 5
0
        void InitializeARKit(serializableARKitInit sai)
        {
                        #if !UNITY_EDITOR
            //get the config and runoption from editor and use them to initialize arkit on device
            Application.targetFrameRate = 60;
            m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
            ARKitWorldTrackingSessionConfiguration config = sai.config;
            UnityARSessionRunOption runOptions            = sai.runOption;

            //potentially improves framerate?
            //https://bitbucket.org/Unity-Technologies/unity-arkit-plugin/issues/78/remote-very-low-fps-and-repeated

            UnityARSessionNativeInterface session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
            config.planeDetection = UnityARPlaneDetection.Horizontal;
            var videoFormat = UnityARVideoFormat.SupportedVideoFormats()[UnityARVideoFormat.SupportedVideoFormats().Count - 1];
            config.videoFormat          = videoFormat.videoFormatPtr;
            Application.targetFrameRate = videoFormat.framesPerSecond;

            m_session.RunWithConfigAndOptions(config, runOptions);

            UnityARSessionNativeInterface.ARFrameUpdatedEvent  += ARFrameUpdated;
            UnityARSessionNativeInterface.ARAnchorAddedEvent   += ARAnchorAdded;
            UnityARSessionNativeInterface.ARAnchorUpdatedEvent += ARAnchorUpdated;
            UnityARSessionNativeInterface.ARAnchorRemovedEvent += ARAnchorRemoved;
                        #endif
            // #if !UNITY_EDITOR
            // //get the config and runoption from editor and use them to initialize arkit on device
            // Application.targetFrameRate = 60;
            // m_session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
            // ARKitWorldTrackingSessionConfiguration config = sai.config;
            // UnityARSessionRunOption runOptions = sai.runOption;
            // m_session.RunWithConfigAndOptions(config, runOptions);

            // UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated;
            // UnityARSessionNativeInterface.ARAnchorAddedEvent += ARAnchorAdded;
            // UnityARSessionNativeInterface.ARAnchorUpdatedEvent += ARAnchorUpdated;
            // UnityARSessionNativeInterface.ARAnchorRemovedEvent += ARAnchorRemoved;
            // #endif
        }