cancel
Showing results for 
Search instead for 
Did you mean: 

GearVR Controller in editor

dakom
Level 3
I'm having trouble getting the GearVR controller to work in the Unity Editor.

Here's my basic script (attached to a simple GameObject):
```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class Wand : MonoBehaviour {
    void Update() {
        transform.rotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTrackedRemote);
    }

/* ALTERNATIVE:
    public Transform controller;
   
    public static bool leftHanded { get; private set; }
 
    void Awake() {
        #if UNITY_EDITOR
        leftHanded = false;        // (whichever you want to test here)
        #else
        leftHanded = OVRInput.GetControllerPositionTracked(OVRInput.Controller.LTouch);
        #endif
    }
 
    void Update() {

        OVRInput.Controller c = leftHanded ? OVRInput.Controller.LTouch : OVRInput.Controller.RTouch;
        if (OVRInput.GetControllerPositionTracked(c)) {
            controller.localRotation = OVRInput.GetLocalControllerRotation(c);
            controller.localPosition = OVRInput.GetLocalControllerPosition(c);
        }
    }  
    */
}
```

Unity Editor log:

uuuynpm6fhc8.png

Note that the Unity Editor says "Virtual Reality SDK Oculus failed to initialize." as a warning, though I think that makes sense since there's no Rift or native windows VR device connected

I've dragged the OVRCameraRig prefab into the scene, and can emulate that by holding control and moving the mouse

I've connected my GearVR controller via bluetooth

Added the Oculus ID to settings

Created a sig file and added it to the project

Help please 🙂
1 REPLY 1

dakom
Level 3
Also - UnityEngine.Input.GetJoystickNames(); returns an empty list