Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

How to control Input for Oculus Go

this works in unity but not in the oculus 

void Update() { float moveHorizontal = Input.GetAxis("Horizontal"); float moveVertical = Input.GetAxis("Vertical"); Vector3 position = transform.position; position.x += moveHorizontal * speed * Time.deltaTime; position.z += moveVertical * speed * Time.deltaTime; transform.position = position; }


  • PAaltoPAalto Posts: 87 Oculus Start Member
    edited January 2019
    You mean it works in Unity Editor but not in the actual device? Yeah, you need to look at methods from the OVRInput class to get the Oculus Go controller input (controller orientation and touchpad touch positions). Your code seems to be for controlling movement, but there is no direct analogue for that with the Oculus Go controller. You need to think about how you want to handle that with the options the Oculus Go controller provides.
  • treeviewstudiostreeviewstudios Posts: 39
    Brain Burst
     i would suggest you to try VRTK, its great for fast gameplay interations.
    the class VRTK_ControllerEvents has a lot of multiplat features.
  • mhenrydpaimhenrydpai Posts: 8

    I tried to import VRTK, but I am getting this error:

    Assets\VRTK\Scripts\Interactions\Highlighters\VRTK_MaterialColorSwapHighlighter.cs(146,70): error CS0122: 'Texture.Texture()' is inaccessible due to its protection level

  • mhenrydpaimhenrydpai Posts: 8
    any suggestions on what to use in OVRInput class to replace Input.GetAxi("Horizontal") and Input.GetAxis("Vertical")
  • PAaltoPAalto Posts: 87 Oculus Start Member
    This is what I use in Gear VR, I assume something similar work with Oculus Go:
    // Queries active Gear VR Controller touchpad click position 
    // (normalized to a -1.0, 1.0 range, where -1.0, -1.0 is the lower-left corner)
    Vector2 touchPos = OVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad, OVRInput.GetActiveController());
    If you need the user to also click on the touchpad before you register the touch position, use the above inside
    if (OVRInput.Get(OVRInput.Button.One))
    Hope this gets you started!

Sign In or Register to comment.