Forum Discussion
dakom
6 years agoExplorer
GearVR Controller in editor
I'm having trouble getting the GearVR controller to work in the Unity Editor.
Here's my basic script (attached to a simple GameObject):
```
Unity Editor log:
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 :)
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:
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
Replies have been turned off for this discussion
- dakomExplorerAlso - UnityEngine.Input.GetJoystickNames(); returns an empty list
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 10 months ago
- 7 months ago
- 10 months ago
- 10 months ago