Reset selection radial when looking at a different object (timed gaze input)

Hi there. So I am using the VR Samples package to develop for the GearVR and have implemented a time gaze function by amending the SelectionRadial.cs as per this thread.

However, doing it this way, it’s hardly functional for what I want to achieve, as the selection radial is not resetting at all when looking at different objects, i.e. with a selection fill time of say 3, if I am looking at door1 for 2secs and then decide to rather go through door2, I’ll load into door2’s level after only 1 sec of looking at it.

I guess I need to implement some way to actively stop the selection radial and to restart afresh? The below is already part of the code but does not seem to work for gaze input. There were also some people questioning this in the above mentioned thread but unfortunately nobody found a fix as of yet.

        public void Hide()
        {
            m_Selection.gameObject.SetActive(false);
            m_IsSelectionRadialActive = false;
            m_Selection.fillAmount = 0f;         // This effectively resets the radial for when it's shown again.    
        }


        private IEnumerator FillSelectionRadial()
        {
            m_RadialFilled = false;
            float timer = 0f;
            m_Selection.fillAmount = 0f;
          
            while (timer < m_SelectionDuration)
            {
               m_Selection.fillAmount = timer / m_SelectionDuration;
               timer += Time.deltaTime;
               yield return null;
            }
            m_Selection.fillAmount = 1f;
            m_IsSelectionRadialActive = false;
            m_RadialFilled = true;
            if (OnSelectionComplete != null)
                OnSelectionComplete();
        }


        public IEnumerator WaitForSelectionRadialToFill ()
        {
            m_RadialFilled = false;
            Show ();
            while (!m_RadialFilled)
            {
                yield return null;
            }
                Hide ();
        }


        private void HandleDown()
        {
                if (m_IsSelectionRadialActive)
            {
                m_SelectionFillRoutine = StartCoroutine(FillSelectionRadial());
            }
        }


        private void HandleUp()
        {
                if (m_IsSelectionRadialActive)
            {
                if(m_SelectionFillRoutine != null)
                    StopCoroutine(m_SelectionFillRoutine);
                m_Selection.fillAmount = 0f;
            }
        }
    }

I suggest using the GoogleVR Reticle for GearVR input. Here is info how to use it:
youtu.be/NfG63Ge3aQk?t=4m21s

Here’s a tutorial on a radial selection button:

And a linear selection button using Unity UI slider:

Aren’t all these videos deploying for google VR though? Also, I’m 5min into the first video, and you (is it you? same logo) are talking about making a custom radial in photoshop for googleVR. That’s not what I’m looking for, and neither is it a slider (second video).

What I’d like to find out is how to shorten the reset time when changing gaze between different interactive game objects. It may well be that the google sdk’s solution is performing better in this instance than what has been made available with Unity’s VR Samples package, but I still want to take advantage of the other code that’s already optimised for the GearVR and don’t want to be stuck with google’s framework.

Do you have any idea what the problem might be with the above code? Does it maybe have something to do with the fact that the last interactive object is not being stored, so that it isn’t specifically being discarded of? The selection radial indicates that it doesn’t see a difference between subsequently selected different game objects.

The problem with Unity’s VR samples is that they have their own independent input system which is pretty messy. The Main Camera needs scripts: VREyeRaycaster.cs, VRInput.cs, VRCameraUI.cs, SelectionRadial.cs, Reticle.cs, VRCameraFade.cs, ReturnToMainMenu.cs. That’s just for the main camera.

Then, on an interactive object you need to put scripts: VRInteractiveItem.cs, SelectionSlider.cs. In your own words, these scripts used together for an input system is “hardly functional for what I want to achieve”. These VR samples are not very friendly for learning, and this input system specifically is messy and not good for someone who is learning scripting in Unity. I don’t understand perfectly what you (or others) will want to achieve but chances are it will take modifications in multiple scripts which are in use. I would look into the following scripts and see how they are working with each other:
VREyeRaycaster.cs, VRInput.cs, SelectionRadial.cs, Reticle.cs, VRInteractiveItem.cs

My tutorials work for both GearVR & GoogleVR (or any VR) and they teach the scripting aspect that you are having trouble with, and how to create and work with some of these VR input systems. They use GoogleVR’s Input System because it’s way better than what Unity built in their VR samples.

1 Like