Пример #1
0
        public static bool Start(TobiiXR_Settings settings = null)
        {
            if (_eyeTrackingProvider != null)
            {
                Debug.LogWarning(string.Format("TobiiXR already started with provider ({0})", _eyeTrackingProvider));
                VerifyInstanceIntegrity();
                return(false);
            }

            if (settings == null)
            {
                settings = TobiiXR_Settings.CreateDefaultSettings();
            }

            _eyeTrackingProvider = settings.EyeTrackingProvider;

            if (_eyeTrackingProvider == null)
            {
                _eyeTrackingProvider = new NoseDirectionProvider();
                Debug.LogWarning(string.Format("Creating ({0}) failed. Using ({1}) as fallback", settings.GetProviderType(), _eyeTrackingProvider.GetType().Name));
            }

            Debug.Log(string.Format("Starting TobiiXR with ({0}) as provider for eye tracking", _eyeTrackingProvider));

            _g2om = settings.G2OM;

            VerifyInstanceIntegrity();

            return(true);
        }
Пример #2
0
        private static TobiiXR_Settings LoadOrCreateDefaultConfiguration()
        {
            bool resourceExists;
            var  settings = TobiiXR_Settings.CreateDefaultSettings(out resourceExists);

            if (!resourceExists)
            {
                var sdkPath  = Path.GetDirectoryName(PathHelper.FindPathToClass(typeof(TobiiXR)));
                var filePath = PathHelper.PathCombine(sdkPath, TobiiXR_SettingsAssetPath);
                var rootPath = Application.dataPath;

                var assetPath = filePath;
                assetPath = assetPath.Replace(rootPath, "Assets");
                assetPath = assetPath.Replace(rootPath.Replace("/", "\\"), "Assets");

                if (File.Exists(filePath))
                {
                    settings = AssetDatabase.LoadAssetAtPath <TobiiXR_Settings>(assetPath);
                    return(settings);
                }

                Directory.CreateDirectory(Path.GetDirectoryName(assetPath));
                AssetDatabase.CreateAsset(settings, assetPath);
                AssetDatabase.SaveAssets();
            }

            return(settings);
        }
Пример #3
0
        public static bool Start(TobiiXR_Settings settings = null)
        {
            if (!TobiiEulaFile.IsEulaAccepted())
            {
                Debug.LogError("You need to accept Tobii Software Development License Agreement to be able to use Tobii XR Unity SDK.");
                return(false);
            }

            if (_eyeTrackingProvider != null)
            {
                Debug.LogWarning(string.Format("TobiiXR already started with provider ({0})", _eyeTrackingProvider));
                VerifyInstanceIntegrity();
                return(false);
            }

            if (settings == null)
            {
                settings = TobiiXR_Settings.CreateDefaultSettings();
            }

            if (settings.FieldOfUse == FieldOfUse.NotSelected)
            {
                //For more info, see https://developer.tobii.com/vr/develop/unity/documentation/configure-tobii-xr/
                Debug.LogError("Field of use has not been selected. Please specify intended field of use in TobiiXR_Settings (can also be edited in Window->Tobii->Tobii Settings)");
            }

            _eyeTrackingProvider = settings.EyeTrackingProvider;

            if (_eyeTrackingProvider == null)
            {
                _eyeTrackingProvider = new NoseDirectionProvider();
                Debug.LogWarning(string.Format("Creating ({0}) failed. Using ({1}) as fallback", settings.GetProviderType(), _eyeTrackingProvider.GetType().Name));
            }

            Debug.Log(string.Format("Starting TobiiXR with ({0}) as provider for eye tracking", _eyeTrackingProvider));

            Internal.Settings = settings;
            Internal.G2OM     = settings.G2OM;

            VerifyInstanceIntegrity();

            return(true);
        }