diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 1eac264ae4..5a58f18a97 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -237,7 +237,7 @@ void MyAvatar::simulate(float deltaTime) { void MyAvatar::updateFromTrackers(float deltaTime) { glm::vec3 estimatedPosition, estimatedRotation; - if (Application::getInstance()->getPrioVR()->isActive()) { + if (Application::getInstance()->getPrioVR()->hasHeadRotation()) { estimatedRotation = glm::degrees(safeEulerAngles(Application::getInstance()->getPrioVR()->getHeadRotation())); estimatedRotation.x *= -1.0f; estimatedRotation.z *= -1.0f; diff --git a/interface/src/devices/PrioVR.cpp b/interface/src/devices/PrioVR.cpp index 064e2be4b5..d8fda89e1a 100644 --- a/interface/src/devices/PrioVR.cpp +++ b/interface/src/devices/PrioVR.cpp @@ -62,8 +62,13 @@ PrioVR::~PrioVR() { #endif } -glm::quat PrioVR::getHeadRotation() const { - const int HEAD_ROTATION_INDEX = 0; +const int HEAD_ROTATION_INDEX = 0; + +bool PrioVR::hasHeadRotation() const { + return _humanIKJointIndices.size() > HEAD_ROTATION_INDEX && _humanIKJointIndices.at(HEAD_ROTATION_INDEX) != -1; +} + +glm::quat PrioVR::getHeadRotation() const { return _jointRotations.size() > HEAD_ROTATION_INDEX ? _jointRotations.at(HEAD_ROTATION_INDEX) : glm::quat(); } diff --git a/interface/src/devices/PrioVR.h b/interface/src/devices/PrioVR.h index 9cd7bda5d4..20f67df751 100644 --- a/interface/src/devices/PrioVR.h +++ b/interface/src/devices/PrioVR.h @@ -35,6 +35,8 @@ public: bool isActive() const { return !_jointRotations.isEmpty(); } + bool hasHeadRotation() const; + glm::quat getHeadRotation() const; glm::quat getTorsoRotation() const;