Search Unity

Timed Cursor on gaze help!

Discussion in 'Getting Started' started by SithRuleTwo, Feb 8, 2019.

  1. SithRuleTwo

    SithRuleTwo

    Joined:
    Jun 20, 2018
    Posts:
    5
    Hi all!

    Im very inexperienced with Unity and VR and have almost no experience scripting, but Im getting the hang of it quickly I think.

    Im trying to have an image fill while looking at it, in the long run Id like it to fill and act as a button that starts movement on a set path. Its like the VR game Lands End.

    Ive already managed to get a button to highlight when looking at it. I just cant figure out to get the other image, the circle that will fill, to do the same.

    Any help would be appreciated. Ive been up and down the internet and youtube, but have only been able to make minor steps to where I am now.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    How have you gotten the button to highlight when you look at it? Can you post the code, or if you're using a plugin, say which one and show how you've set it up?
     
  3. SithRuleTwo

    SithRuleTwo

    Joined:
    Jun 20, 2018
    Posts:
    5
    I hope this explains a bit

    I have two buttons and through tutorials and experimentation, I have them both highlighting on gaze, but by different methods. Both are buttons on a canvas

    One is using the VR Interactive Item and and the example interactive item script that is in the VR Standard assets.

    The other is using a few scripts I found on youtube tutorials and the OVR Gaze Event trigger and Event trigger scripts from the Oculus SDK. This one seems like its overly convoluted in comparison. The script Im using there is called VR Button:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;

    public class VRButton : MonoBehaviour {

    public Image BackgroundImage;
    public Color NormalColor;
    public Color HighlightColor;

    // Use this for initialization
    void Start() {

    }

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

    }

    public void OnGazeEnter() {
    BackgroundImage.color = HighlightColor;
    }

    public void OngazeExit() {
    BackgroundImage.color = NormalColor;
    }

    public void OnClick() {
    Debug.Log("Click Received");
    }
    }