Example #1
0
    // ********************************************************************************************************************
    //
    //  Calibration is performed if the calibration is necessary.
    //
    // ********************************************************************************************************************
    void Calibration()
    {
        SRanipal_Eye_API.IsUserNeedCalibration(ref cal_need);           // Check the calibration status. If needed, we perform the calibration.

        if (cal_need == true)
        {
            result_cal = SRanipal_Eye_v2.LaunchEyeCalibration();

            if (result_cal == true)
            {
                Debug.Log("Calibration is done successfully.");
            }

            else
            {
                Debug.Log("Calibration is failed.");
                if (UnityEditor.EditorApplication.isPlaying)
                {
                    UnityEditor.EditorApplication.isPlaying = false;    // Stops Unity editor if the calibration if failed.
                }
            }
        }

        if (cal_need == false)
        {
            Debug.Log("Calibration is not necessary");
        }
    }
Example #2
0
        private void Awake()
        {
            // Tobi XR Settings
            TobiiXR.Start(Settings);

            // Get the Participant Name
            _participantName = PlayerPrefs.HasKey("playerName")
                ? PlayerPrefs.GetString("playerName")
                : "DemoParticipant-" + DateTime.Now.ToFileTime();

            if (_participantName.Equals(""))
            {
                _participantName = "DemoParticipant-" + DateTime.Now.ToFileTime();
            }


            // Check eye calibration is required.
            bool isEyeCalibrationRequired = false;

            if (SRanipal_Eye_API.IsViveProEye())
            {
                int error = SRanipal_Eye_API.IsUserNeedCalibration(ref isEyeCalibrationRequired);
                if (isEyeCalibrationRequired)
                {
                    Debug.Log("Eye Calibration Required!");
                    Logger.Log(LogLevel.INFO, "Eye Calibration Required!");

                    SRanipal_Eye.LaunchEyeCalibration();
                    Debug.Log("Eye Calibration error: " + error);
                    Logger.Log(LogLevel.DEBUG, "Eye Calibration error: " + error);
                }
                else
                {
                    Debug.Log("Eye Calibration Not Required!");
                    Logger.Log(LogLevel.INFO, "Eye Calibration Not Required!");
                }
            }
            else
            {
                Debug.Log("Eye Tracking not supported in this device! Device is not HTC-Vive Pro Eye.");
                Logger.Log(LogLevel.INFO, "Eye Tracking not supported in this device! Device is not HTC-Vive Pro Eye.");
                enableEyeTracking = false;
            }
        }