From f45db99149946bc61a97034e98af77c97da367ac Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 1 Jun 2017 14:35:53 -0700 Subject: [PATCH] for the moment, vive input plugin isn't a head-controller unless the HMD is being worn --- plugins/openvr/src/ViveControllerManager.cpp | 5 +++++ plugins/openvr/src/ViveControllerManager.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/openvr/src/ViveControllerManager.cpp b/plugins/openvr/src/ViveControllerManager.cpp index 53500a3353..11d390fca4 100644 --- a/plugins/openvr/src/ViveControllerManager.cpp +++ b/plugins/openvr/src/ViveControllerManager.cpp @@ -138,6 +138,11 @@ void ViveControllerManager::deactivate() { _registeredWithInputMapper = false; } +bool ViveControllerManager::isHeadController() const { + vr::EDeviceActivityLevel activityLevel = _system->GetTrackedDeviceActivityLevel(vr::k_unTrackedDeviceIndex_Hmd); + return activityLevel == vr::k_EDeviceActivityLevel_UserInteraction; +} + void ViveControllerManager::pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) { if (!_system) { diff --git a/plugins/openvr/src/ViveControllerManager.h b/plugins/openvr/src/ViveControllerManager.h index 6532540285..0fdd04fdfb 100644 --- a/plugins/openvr/src/ViveControllerManager.h +++ b/plugins/openvr/src/ViveControllerManager.h @@ -41,7 +41,7 @@ public: const QString getName() const override { return NAME; } bool isHandController() const override { return true; } - bool isHeadController() const override { return true; } + bool isHeadController() const override; bool activate() override; void deactivate() override;