When PrioVR is connected but head rotation is unavailable, use Faceshift

rotation.
This commit is contained in:
Andrzej Kapolka 2014-05-15 11:37:58 -07:00
parent 565f6b9491
commit f28ba72f75
3 changed files with 10 additions and 3 deletions

View file

@ -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;

View file

@ -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();
}

View file

@ -35,6 +35,8 @@ public:
bool isActive() const { return !_jointRotations.isEmpty(); }
bool hasHeadRotation() const;
glm::quat getHeadRotation() const;
glm::quat getTorsoRotation() const;