06-05-2019 03:07 PM
Using: Unity 2018.4.1 LTS & Oculus GO
I am using a gaze pointer to interact with Unity UI.
This is supposed to happen when you pull the trigger, exactly how I defined it in my script: a swipe left or right on the touchpad of the go-controller however triggers clicks as well. I did not define this myself, it's just a thing that happens and I can not figure out how to work around it.
I found and fiddled around with solutions proposed in this thread and this thread.
However, none of these solutions provided me a way to get rid of these swipe clicks while keeping alive index trigger clicks.
My Input Manager (Index Trigger Interaction with UI seems to happen in OVRInputModule):
private void Update()
{
if (OVRInput.GetDown(OVRInput.Button.PrimaryTouchpad) || OVRInput.GetDown(OVRInput.Button.Two))
{
ToggleVidInterface();
}
if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
{
StartCoroutine(TouchpadCounter());
}
}
IEnumerator TouchpadCounter()
{
int secondsForCounting = 2;
float startTime = Time.time;
int touchCount = 0;
while (Time.time - startTime <= secondsForCounting && OVRInput.Get(OVRInput.Button.PrimaryIndexTrigger))
{
if (OVRInput.GetDown(OVRInput.Button.PrimaryTouchpad))
{
touchCount++;
Debug.Log("touchCount for Admin Menue: " + touchCount);
}
if (touchCount >= 3)
{
ActivateAdminMenue();
}
yield return null;
}
yield return null;
}
Part of the OVRInputModule (I don't know if its the right part):
/// <summary>
/// Get state of button corresponding to gaze pointer
/// </summary>
/// <returns></returns>
virtual protected PointerEventData.FramePressState GetGazeButtonState()
{
var pressed = Input.GetKeyDown(gazeClickKey) || OVRInput.GetDown(joyPadClickButton);
var released = Input.GetKeyUp(gazeClickKey) || OVRInput.GetUp(joyPadClickButton);
#if UNITY_ANDROID && !UNITY_EDITOR
// On Gear VR the mouse button events correspond to touch pad events. We only use these as gaze pointer clicks
// on Gear VR because on PC the mouse clicks are used for actual mouse pointer interactions.
pressed |= Input.GetMouseButtonDown(0);
released |= Input.GetMouseButtonUp(0);
#endif
if (pressed && released)
return PointerEventData.FramePressState.PressedAndReleased;
if (pressed)
return PointerEventData.FramePressState.Pressed;
if (released)
return PointerEventData.FramePressState.Released;
return PointerEventData.FramePressState.NotChanged;
}
Messing with the Android if condition just enables or disables clicking as a whole (trigger and touchpad). What am I missing here? How can I seperate between a trigger click and a touchpad swipe?!