From 0af62ca946a3a9631bff51481f4fbc26a00ebf79 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 14 Jul 2015 16:39:12 -0700 Subject: [PATCH 1/2] Convert tabs to spaces --- interface/src/avatar/MyAvatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 79c600b7ec..1c7da32ea4 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -79,7 +79,7 @@ const float MyAvatar::ZOOM_MAX = 25.0f; const float MyAvatar::ZOOM_DEFAULT = 1.5f; MyAvatar::MyAvatar() : - Avatar(), + Avatar(), _gravity(0.0f, 0.0f, 0.0f), _wasPushing(false), _isPushing(false), From fc0ae17a87a06abac5758d5d57f48fe9b36a3d33 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 14 Jul 2015 16:42:46 -0700 Subject: [PATCH 2/2] Mirror head when using face tracker in fullscreen mirror Mirror translation, yaw, and roll in the same manner as done for HMD case, to mimic what you would expect to see in a mirror. --- interface/src/avatar/MyAvatar.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 1c7da32ea4..0cc762cf6c 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -253,6 +253,9 @@ void MyAvatar::updateFromTrackers(float deltaTime) { return; } + FaceTracker* tracker = Application::getInstance()->getActiveFaceTracker(); + bool inFacetracker = tracker && !tracker->isMuted(); + if (inHmd) { estimatedPosition = qApp->getHeadPosition(); estimatedPosition.x *= -1.0f; @@ -260,12 +263,17 @@ void MyAvatar::updateFromTrackers(float deltaTime) { const float OCULUS_LEAN_SCALE = 0.05f; estimatedPosition /= OCULUS_LEAN_SCALE; - } else { - FaceTracker* tracker = Application::getInstance()->getActiveFaceTracker(); - if (tracker && !tracker->isMuted()) { - estimatedPosition = tracker->getHeadTranslation(); - _trackedHeadPosition = estimatedPosition; - estimatedRotation = glm::degrees(safeEulerAngles(tracker->getHeadRotation())); + } else if (inFacetracker) { + estimatedPosition = tracker->getHeadTranslation(); + _trackedHeadPosition = estimatedPosition; + estimatedRotation = glm::degrees(safeEulerAngles(tracker->getHeadRotation())); + if (Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) { + // Invert yaw and roll when in mirror mode + // NOTE: this is kinda a hack, it's the same hack we use to make the head tilt. But it's not really a mirror + // it just makes you feel like you're looking in a mirror because the body movements of the avatar appear to + // match your body movements. + YAW(estimatedRotation) *= -1.0f; + ROLL(estimatedRotation) *= -1.0f; } } @@ -312,7 +320,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) { // NOTE: this is kinda a hack, it's the same hack we use to make the head tilt. But it's not really a mirror // it just makes you feel like you're looking in a mirror because the body movements of the avatar appear to // match your body movements. - if (inHmd && Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) { + if ((inHmd || inFacetracker) && Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) { relativePosition.x = -relativePosition.x; }