// Update is called once per frame void Update() { device = SteamVR_Controller.Input((int)trackedObj.index); if (device.GetPressDown(SteamVR_Controller.ButtonMask.ApplicationMenu) && !menuHide) { menuInstructions.SetActive(false); menuHide = true; } else { if (objectMenuManager != null) { if (device.GetPressDown(SteamVR_Controller.ButtonMask.ApplicationMenu) && menuHide) { if (isOpen) { objectMenuManager.HideMenu(); isOpen = false; } else { objectMenuManager.DisplayMenu(); isOpen = true; } } if (objectMenuManager.gameObject.activeInHierarchy) { if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad)) { touchLast = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x; touchLastY = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).y; } if (device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad)) { touchCurrent = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x; touchCurrentY = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).y; distance = touchCurrent - touchLast; touchLast = touchCurrent; swipeSum += distance; if (!hasSwipedRight) { if (touchCurrent > 0f && touchCurrentY > -0.2f) { swipeSum = 0; SwipeRight(); hasSwipedRight = true; hasSwipedLeft = false; } } if (!hasSwipedLeft) { if (touchCurrent < 0f && touchCurrentY > -0.2f) { swipeSum = 0; SwipeLeft(); hasSwipedLeft = true; hasSwipedRight = false; } } } if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad)) { swipeSum = 0; touchCurrent = 0; touchLast = 0; hasSwipedLeft = false; hasSwipedRight = false; } if (device.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad)) { if (touchCurrentY < 0f) { SpawnObject(); } //Spawn object currently selected by menu } } } } }