Search Unity

OVRInput cant get any movement with the Oculus Remote.

Discussion in 'Scripting' started by KenClemson, Nov 3, 2016.

  1. KenClemson

    KenClemson

    Joined:
    Oct 6, 2016
    Posts:
    24
    I'm try to make a cube move as an easy example but I cant seem to get any movement with the Oculus Remote, I'm guessing you need to have a certain OVR component attached to the cube, has anyone got any insight into this.


    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class MovewithOculus : MonoBehaviour
    5. {
    6.     public float speed = 5.0f;
    7.  
    8.     void Update()
    9.     {
    10.         //Move the cube left or right with Keys.
    11.         if (Input.GetKeyDown(KeyCode.D))
    12.         {
    13.             transform.Translate(Vector3.right * speed * Time.deltaTime);
    14.             Debug.Log("Key move right");
    15.         }
    16.         if (Input.GetKeyDown(KeyCode.A))
    17.         {
    18.             transform.Translate(Vector3.left * speed * Time.deltaTime);
    19.             Debug.Log("Key move left");
    20.         }
    21.  
    22.         //Move the cube left or right with the oculus remote.
    23.         if (OVRInput.GetDown(OVRInput.Button.DpadRight, OVRInput.Controller.Remote))
    24.         {
    25.             transform.Translate(Vector3.right * speed * Time.deltaTime);
    26.             Debug.Log("Oculus Remote move right");
    27.         }
    28.         if (OVRInput.GetDown(OVRInput.Button.DpadLeft, OVRInput.Controller.Remote))
    29.         {
    30.             transform.Translate(Vector3.left * speed * Time.deltaTime);
    31.             Debug.Log("Oculus Remote move left");
    32.         }
    33.     }
    34. }
     
  2. LTPStudioXR

    LTPStudioXR

    Joined:
    Nov 1, 2016
    Posts:
    11
    Any luck with this? I'm running into the same problem.

    *SOLVED*
    Download the latest Oculus for Unity 5 utilities package https://developer3.oculus.com/downloads/
    delete previous versions of plugins and OVR folder associated with oculus then import package (version 1.10.... currently working)
    Then use OVRCameraRig (this will take care of OVRInput stuff) instead of a mainCam

    test with
    if (OVRInput.GetUp(OVRInput.Button.DpadUp, OVRInput.Controller.Remote))
    {
    Debug.Log("remote click");
    }
     
    Last edited: Dec 17, 2016
  3. fseydel

    fseydel

    Joined:
    Jan 23, 2014
    Posts:
    5
    "I have now found out that the trick to getting OVRInput.Get() work properly is to make sure that OVRInput.Update() is called regularly. This can either be done manually or it will be performed automatically if the OVRCameraRig is used, instead of a normal camera." (taken from http://answers.unity3d.com/answers/1306588/view.html)