Пример #1
0
 private void Update()
 {
     //listen to key control inputs
     if (runCalibrationOnKeypress && Input.GetKeyDown(CalibrationKey))
     {
         SRanipal_Eye_API.LaunchEyeCalibration(System.IntPtr.Zero);
     }
     if (Input.GetKeyDown(GazeVisualizationKey))
     {
         drawGazeSphere = !drawGazeSphere;
         gazeSphere.SetActive(drawGazeSphere);
     }
 }
Пример #2
0
                private void OnGUI()
                {
                    if (GUILayout.Button("Set Parameter"))
                    {
                        EyeParameter parameter = new EyeParameter
                        {
                            gaze_ray_parameter = new GazeRayParameter(),
                        };
                        Error error = SRanipal_Eye_API.GetEyeParameter(ref parameter);
                        Debug.Log("GetEyeParameter: " + error + "\n" +
                                  "sensitive_factor: " + parameter.gaze_ray_parameter.sensitive_factor);

                        parameter.gaze_ray_parameter.sensitive_factor = parameter.gaze_ray_parameter.sensitive_factor == 1 ? 0.015f : 1;
                        error = SRanipal_Eye_API.SetEyeParameter(parameter);
                        Debug.Log("SetEyeParameter: " + error + "\n" +
                                  "sensitive_factor: " + parameter.gaze_ray_parameter.sensitive_factor);
                    }

                    if (GUILayout.Button("Launch Calibration"))
                    {
                        SRanipal_Eye_API.LaunchEyeCalibration(IntPtr.Zero);
                    }
                }
Пример #3
0
    private void Start()
    {
        if (!SRanipal_Eye_Framework.Instance.EnableEye)
        {
            enabled = false;
            return;
        }

        if (runCalibrationOnStart)
        {
            SRanipal_Eye_API.LaunchEyeCalibration(System.IntPtr.Zero);
        }

        /*GazeRayParameter param = new GazeRayParameter();
         * param.sensitive_factor = 1;
         * EyeParameter eyeParam = new EyeParameter();
         * eyeParam.gaze_ray_parameter = param;
         * SRanipal_Eye_API.SetEyeParameter(eyeParam);*/

        //instantiate the gaze sphere (either to be usede or not)
        gazeSphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        Collider gazeSphereCollider = gazeSphere.GetComponent <Collider>();

        gazeSphereCollider.enabled      = false;
        gazeSphere.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
        gazeSphere.transform.position   = gazeSphereHiddenPosition;
        gazeSphere.SetActive(drawGazeSphere);

        /*
         * ignoreLayer is a bit mask that tells which layers should be subjected to Physics.Raycast function,
         * this way it is inverted, so only the layer with id of ignoreLayer is really ignored.
         */
        ignoreLayerBitMask = 1 << ignoreLayer;
        ignoreLayerBitMask = ~ignoreLayerBitMask;

        //init the logger (PathScript, in this case)
        if (Logger != null && Logger.GetComponent <PathScript>() != null)
        {
            LoggerFormatDictionary = Logger.GetComponent <PathScript>().getLogFormat();
            //set number format, per what is specified in logger
            numberFormat = new NumberFormatInfo();
            numberFormat.NumberDecimalSeparator = LoggerFormatDictionary["decimalFormat"];
            generateCustomLogVariables();
            Logger.GetComponent <PathScript>().generateCustomFileNames(customLogVariables, logName, this.name);
            loggerInitialized = true;
            //init the stringbuilder
            logDataSb = new StringBuilder("", 256);
        }
        else
        {
            Debug.LogWarning("No eyetracking logger found on " + Logger.name +
                             ". Therefore, HTC ET script on " + this.name + " not logging.");
        }

        //init the Canvas GUI fixation logger
        if (FixationCanvas == null && logFixationToCanvas)
        {
            Debug.LogWarning("No fixation canvas for ET logging. Disabling this functionality");
            logFixationToCanvas = false;
        }
    }
Пример #4
0
    /// <summary>
    /// This method launches the eye-tracking calibration process of the Vive Pro Eye.
    /// This method can be hooked to a 3D Button
    /// </summary>
    public void Execute()
    {
#if VIVESR
        SRanipal_Eye_API.LaunchEyeCalibration(IntPtr.Zero);
#endif
    }
Пример #5
0
 /// <summary>
 /// This method launches the eye-tracking calibration process of the Vive Pro Eye.
 /// This method can be hooked to a 3D Button
 /// </summary>
 public void Execute()
 {
     SRanipal_Eye_API.LaunchEyeCalibration(IntPtr.Zero);
 }
Пример #6
0
                /// <summary>
                /// Launches anipal's Eye Calibration feature (an overlay program).
                /// </summary>
                /// <returns>Indicates the resulting ViveSR.Error status of this method.</returns>
                public static bool LaunchEyeCalibration()
                {
                    int result = SRanipal_Eye_API.LaunchEyeCalibration(IntPtr.Zero);

                    return(result == (int)Error.WORK);
                }