// Update is called once per frame void Update() { device = SteamVR_Controller.Input((int)trackedObj.index); if (leftHand) { menuStickX = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, thisController).x; if (menuStickX < 0.45f && menuStickX > -0.45f) { menuIsSwipable = true; } if (menuIsSwipable) { if (menuStickX >= 0.45f) { //fire function that looks at menuList, //disables current item, and enables next item objectMenuManager.MenuRight(); menuIsSwipable = false; } else if (menuStickX <= -0.45f) { objectMenuManager.MenuLeft(); menuIsSwipable = false; } } } if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger, thisController)) { objectMenuManager.SpawnCurrentObject(); } }
// Teleport and Swipe Logic void Update() { device = SteamVR_Controller.Input((int)trackedObject.index); //Debug.Log(trackedObject.index); //detect touch if (device.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad)) { touch = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad); if (touch.x > touchTolerance) { objectMenuManager.MenuRight(); Debug.Log("MenuRight"); } if (touch.x < -touchTolerance) { objectMenuManager.MenuLeft(); Debug.Log("MenuLeft"); } } //Grip if (device.GetPressUp(SteamVR_Controller.ButtonMask.Trigger)) { objectMenuManager.SpawnCurrentObject(); } }
void Swipe(bool direction) { if (direction) { OMM.MenuRight(); Debug.Log("Swiped right!"); } else { OMM.MenuLeft(); Debug.Log("Swiped left!"); } }
void Update() { controller = SteamVR_Controller.Input((int)trackedObj.index); UISelector(); if (controller.GetPressDown(SteamVR_Controller.ButtonMask.ApplicationMenu)) { Toggler(); } // right hand functions if (controller.GetTouch(SteamVR_Controller.ButtonMask.Touchpad)) { Debug.Log("right touched!"); } // activate/deactivate objectMenu on touchpad press if (controller.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad)) { Debug.Log("right tp pressed down!"); objectMenu.SetActive(!objectMenu.activeSelf); } if (objectMenu.activeSelf) { if (controller.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad)) { float touchCurrent = controller.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x; if (touchCurrent < 0f) { omm.MenuLeft(); } else { omm.MenuRight(); } } if (controller.GetPressDown(SteamVR_Controller.ButtonMask.Trigger)) { omm.SpawnObject(); } } }
void Update() { //---------------------------------------------------------------------------TELEPORTATION------------------------------------------------------------------------------------------------ deviceLeft = SteamVR_Controller.Input((int)trackedObj.index); deviceRight = SteamVR_Controller.Input((int)trackedObjRight.index); if (deviceLeft.GetPress(SteamVR_Controller.ButtonMask.Touchpad)) { laser.gameObject.SetActive(true); teleportAimerObject.SetActive(true); laser.SetPosition(0, LeftController.transform.position); RaycastHit hit; if (Physics.Raycast(LeftController.transform.position, LeftController.transform.forward, out hit, 15, laserMask)) { //Debug.Log("The ray can collide with something"); teleportLocation = hit.point; //Debug.Log("hit.point = " + hit.point); laser.SetPosition(1, teleportLocation); // aimer position teleportAimerObject.transform.position = new Vector3(teleportLocation.x, teleportLocation.y + yNudgeAmount, teleportLocation.z); } else { // Debug.Log("using the height raycast method"); teleportLocation = new Vector3(LeftController.transform.forward.x * 15 + LeftController.transform.position.x, LeftController.transform.forward.y * 15 + LeftController.transform.position.y, LeftController.transform.forward.z * 15 + LeftController.transform.position.z); RaycastHit groundRay; if (Physics.Raycast(teleportLocation, -Vector3.up, out groundRay, 17, laserMask)) { //Debug.Log("Lasermask Condition met"); teleportLocation = new Vector3(LeftController.transform.forward.x * 15 + LeftController.transform.position.x, groundRay.point.y, LeftController.transform.forward.z * 15 + LeftController.transform.position.z); } else { teleportLocation = player.transform.position; } laser.SetPosition(1, LeftController.transform.forward * 15 + LeftController.transform.position); // aimer position teleportAimerObject.transform.position = teleportLocation + new Vector3(0, yNudgeAmount, 0); } } if (deviceLeft.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad)) { laser.gameObject.SetActive(false); teleportAimerObject.SetActive(false); player.transform.position = new Vector3(teleportLocation.x, player.transform.position.y, teleportLocation.z); } //-------------------------------------------------------------MENU---------------------------------------------- if (deviceRight.GetTouch(SteamVR_Controller.ButtonMask.Touchpad)) { objectmenu.SetActive(true); touchPoint = deviceRight.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x; if (touchPoint > 0.7f) { if (!hasJustSelected) { objectMenuManager.MenuRight(); hasJustSelected = true; // StartCoroutine("MenuCoolDown"); } } else if (touchPoint < -0.7f) { if (!hasJustSelected) { objectMenuManager.MenuLeft(); hasJustSelected = true; //StartCoroutine("MenuCoolDown"); } } if (touchPoint > -0.1f && touchPoint < 0.1f) { hasJustSelected = false; } if (deviceRight.GetPressDown(SteamVR_Controller.ButtonMask.Trigger)) { SpawnObject(); } } if (deviceRight.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad)) { objectmenu.SetActive(false); } }
void SwipeRight() { objectMenuManager.MenuRight(); }
void SwipeRight() { objectMenuManager.MenuRight(); //Debug.Log("Swiped left"); GetComponent <AudioSource>().PlayOneShot(scroll, 1); }
// Update is called once per frame void Update() { device = SteamVR_Controller.Input((int)trackedObject.index); if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad)) { if (!isLeftHand) { objectMenuManager.EnableMenu(); touchLast = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x; } } if (device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad)) { if (!isLeftHand) { // TODO: This resets when I move the figure back to the middle 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; objectMenuManager.MenuRight(); hasSwipedRight = true; hasSwipedLeft = false; } } if (!hasSwipedLeft) { if (swipeSum < -0.5f) { swipeSum = 0; objectMenuManager.MenuLeft(); hasSwipedLeft = true; hasSwipedRight = false; } } } } if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad)) { if (!isLeftHand) { objectMenuManager.DisableMenu(); swipeSum = 0; touchCurrent = 0; touchLast = 0; hasSwipedLeft = false; hasSwipedRight = false; } } if (device.GetPressDown(SteamVR_Controller.ButtonMask.Trigger)) { if (introMenu != null && introMenu.activeSelf) { introMenu.SetActive(false); } if (sceneManager.IsLevelComplete()) { sceneManager.LoadNextLevel(); } if (!isLeftHand && objectMenuManager.IsMenuEnabled()) { objectMenuManager.SpawnCurrentObject(); } } }
void SwipeRight() { objectMenuManager.MenuRight(); Debug.Log("SwipeRight"); }
public void swipeRight() { objectMenuManager.MenuRight(); // Debug.Log("Swipe Right"); }
// Update is called once per frame void Update() { device = SteamVR_Controller.Input((int)trackObj.index); // Teleportation w/ Left Touchpad if (isLeft) { if (device.GetPress(SteamVR_Controller.ButtonMask.Touchpad)) { laser.gameObject.SetActive(true); laser.SetPosition(0, gameObject.transform.position); RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit, rayLength, laserMask)) { teleportLocation = hit.point; laser.SetPosition(1, teleportLocation); aimerObj.SetActive(true); aimerObj.transform.position = teleportLocation + new Vector3(0, aimerYAdjust, 0); } else { teleportLocation = transform.forward * rayLength + transform.position; laser.SetPosition(1, teleportLocation); RaycastHit groundRay; if (Physics.Raycast(teleportLocation, -Vector3.up, out groundRay, 17, laserMask)) { teleportLocation = new Vector3( transform.forward.x * 5 + transform.position.x, groundRay.point.y, transform.forward.z * rayLength + transform.position.z); aimerObj.SetActive(true); aimerObj.transform.position = teleportLocation + new Vector3(0, aimerYAdjust, 0); } else { teleportLocation = player.transform.position; } } } if (device.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad)) { laser.gameObject.SetActive(false); aimerObj.SetActive(false); player.transform.position = teleportLocation; } } if (!isLeft) { if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad)) { objMenu.SetActive(true); } if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad)) { objMenu.SetActive(false); } if (device.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad)) { float pressCurr = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x; if (pressCurr > 0) { objMenuManager.MenuRight(); } else { objMenuManager.MenuLeft(); } } if (device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad) && device.GetPressUp(SteamVR_Controller.ButtonMask.Trigger)) { objMenuManager.SpawnCurrentObject(); } } }
private void swipeRight() { menuManager.MenuRight(); }
// Update is called once per frame void Update() { if (OVRInput.Get(OVRInput.Button.Two)) { if (objectMenuManager.isShowing) { menuCancelSource.PlayOneShot(menuCancelClip); objectMenuManager.Show(false); } } float menuStickX = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick).x; if (menuStickX < menuResetThreshold && menuStickX > -menuResetThreshold) { menuCycled = false; } if (!menuCycled) { if (menuComplete && !itemCreationComplete) { SetCreationReady(); } if (menuStickX > menuScrollThreshold) { if (gameController.isTutorial) { oculusUI.SetMenu(false); menuActive = false; menuComplete = true; } menuCycled = true; objectMenuManager.MenuRight(); menuSwitchSource.PlayOneShot(menuSwitchClip); } if (menuStickX < -menuScrollThreshold) { if (gameController.isTutorial) { oculusUI.SetMenu(false); menuActive = false; menuComplete = true; } menuCycled = true; objectMenuManager.MenuLeft(); menuSwitchSource.PlayOneShot(menuSwitchClip); } } if (creationAvailable && objectMenuManager.isShowing && OVRInput.Get(OVRInput.Button.SecondaryThumbstick)) { if (gameController.isTutorial && menuComplete) { oculusUI.SetItemCreation(false); itemCreationComplete = true; } creationAvailable = false; objectMenuManager.Create(); createSource.PlayOneShot(createClip); StartCoroutine(CreationCooldown(creationCooldown)); objectMenuManager.Show(false); } }