FOVE SUPPORT CENTER

Teleport to What You Look At with reyeblink

Answered

Comments

2 comments

  • Avatar
    Lochlainn Wilson

    Hi Kenshin

    Did you get anywhere with your project? If not I am happy to make an example for you using your scripts that you provided.



    0
    Comment actions Permalink
  • Avatar
    Kenshin Kenshin

    hi

    not yet.

    I am happy to make an example for you using your scripts that you provided. ---> thks thks .;;;

    what rong wit this blik to make move (blink r,blink  l,blink ,.;;)

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class DetectBlink : MonoBehaviour {

    [Tooltip("Threshold for blink in seconds \n(Average is between 0.3 and 0.4 seconds)")]
    public float blinkThreshold = 0.5f;
    [Tooltip("Light controlled by blinking")]
    public Light blinkLight;

    /// <summary>
    /// Timer Construct
    /// <param name="value">Holds the value of the timer</param>
    /// <param name="started">Is the timer started?</param>
    /// </summary>
    struct Timer
    {
    public float value { get; set; }
    public bool started { get; set; }
    }

    Timer t;

    // Use this for initialization
    void Start () {
    t = new Timer();
    }

    // Update is called once per frame
    void Update () {

     


    switch (FoveInterface.CheckEyesClosed())
    {
    case Fove.EFVR_Eye.Both:

    t.started = true;
    if (t.started) t.value += Time.deltaTime;
    if (FoveInterface.CheckEyesClosed() == Fove.EFVR_Eye.Neither && t.started)
    {
    /*
    * If time between closing and opening eyes is less than the threshold
    * A blink has been detected
    */
    if (t.value > blinkThreshold)
    {
    // blinkLight.enabled = !blinkLight.enabled;
    GetComponent<Animator>().Play("WAIT01", -1, 0f);
    }

    t.started = false;
    t.value = 0;
    }

    break;
    case Fove.EFVR_Eye.Right:

    t.started = true;
    if (t.started) t.value += Time.deltaTime;
    if (FoveInterface.CheckEyesClosed() == Fove.EFVR_Eye.Neither && t.started)
    {
    /*
    * If time between closing and opening eyes is less than the threshold
    * A blink has been detected
    */
    if (t.value < blinkThreshold)
    {
    // blinkLight.enabled = !blinkLight.enabled;
    GetComponent<Animator>().Play("JUMP00", -1, 0f);
    }else {
    GetComponent<Animator>().Play("WAIT02", -1, 0f);
    }

    t.started = false;
    t.value = 0;
    }

    break;
    case Fove.EFVR_Eye.Left:

    t.started = true;
    if (t.started) t.value += Time.deltaTime;
    if (FoveInterface.CheckEyesClosed() == Fove.EFVR_Eye.Neither && t.started)
    {
    /*
    * If time between closing and opening eyes is less than the threshold
    * A blink has been detected
    */
    if (t.value < blinkThreshold)
    {
    // blinkLight.enabled = !blinkLight.enabled;
    GetComponent<Animator>().Play("WAIT03", -1, 0f);
    }else {
    GetComponent<Animator>().Play("WAIT04", -1, 0f);
    }

    t.started = false;
    t.value = 0;
    }
    break;

    }
    }
    }

     

     

    thks a lot

    0
    Comment actions Permalink

Please sign in to leave a comment.