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
 // ********************************************************************************************************************
 //
 //  Start is called before the first frame update. The Start() function is performed only one time.
 //
 // ********************************************************************************************************************
 void Start()
 {
     InputUserID();                              // Check if the file with the same ID exists.
     Invoke("SystemCheck", 0.5f);                // System check.
     SRanipal_Eye_v2.LaunchEyeCalibration();     // Perform calibration for eye tracking.
     //Calibration();
     TargetPosition();                           // Implement the targets on the VR view.
     Invoke("Measurement", 0.5f);                // Start the measurement of ocular movements in a separate callback function.
 }
Example #3
0
 public void StartCalibration()
 {
     if (SRanipal_Eye_v2.LaunchEyeCalibration())
     {
         Debug.Log("<color=green>calibration successful :)</color>");
         CalibrationManager.Instance.EyeCalibrationSuccessful();
     }
     else
     {
         Debug.Log("<color=red>calibration failed :(</color>");
     }
 }
Example #4
0
        public EyeTrackingMenu(Transform pageRoot)
        {
            Root = pageRoot.gameObject;
            var leftEye = pageRoot.Find("EyeIndicators/LeftEye/Mask/XYLines");
            var rightEye = pageRoot.Find("EyeIndicators/RightEye/Mask/XYLines");
            
            _leftEyeVisualizer = new XYVisualizer(leftEye.Find("X"), leftEye.Find("Y"));
            _rightEyeVisualizer = new XYVisualizer(rightEye.Find("X"), rightEye.Find("Y"));

            _trackingToggle = new ToggleButton(pageRoot.Find("UtilButtons/ToggleActive"));
            _trackingToggle.OnToggle += b => SRanipalTrack.EyeEnabled = b;
            
            pageRoot.Find("UtilButtons/Recalibrate").GetComponent<Button>().onClick.AddListener((Action)(() => SRanipal_Eye_v2.LaunchEyeCalibration()));
        }