'unity - oculus quest - how to read thumbstick input
I'm working on projects for oculus quest using Unity 2019.3. I have done some work in this before, but I am up against a bit for which I am having trouble finding results.
Simply, I want to reference the oculus thumbsticks in script. I have worked with the buttons before and they are just referenced as easily as with the normal unity inputs ("fire", "jump", etc. Can be set to existing input buttons like on a controller). I cannot find the same info for the oculus touch thumbsticks. I have seen ovrinput elements for this, but not in the unity input manager. What would I use to reference those inputs for coding behavior?
Thank you for your time and consideration.
Solution 1:[1]
if (OVRInput.GetUp(OVRInput.Button.PrimaryIndexTrigger))
{
// Do something
}
A list of all OVR input can be found in Unity's manual here.
Solution 2:[2]
Ensure that Oculus Integration package is imported in your project.
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneLoader : MonoBehaviour {
void Update() {
if (OVRInput.Get(OVRInput.Button.Two))
SceneManager.LoadScene("name");
}
}
Refer to Input for Oculus to know more about the Oculus controllers.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | MysticalUser |
Solution 2 | Codemaker |