// Update is called once per frame void Update() { device = SteamVR_Controller.Input((int)trackedObj.index); if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad)) { touchLast = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x; if (objectMenuManager.HasObject()) { ToggleSelect(true); } } if (device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad)) { touchCurrent = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x; distance = touchCurrent - touchLast; touchLast = touchCurrent; swipeSum += distance; if (!hasSwipedRight) { if (swipeSum > 0.5f) { swipeSum = 0; SwipeRight(); hasSwipedRight = true; hasSwipedLeft = false; } } if (!hasSwipedLeft) { if (swipeSum < -0.5f) { swipeSum = 0; SwipeLeft(); hasSwipedRight = false; hasSwipedLeft = true; } } } if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad)) { swipeSum = 0; touchCurrent = 0; touchLast = 0; hasSwipedLeft = false; hasSwipedRight = false; ToggleSelect(false); } if (device.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad)) { SpawnObject(); } }