From 349f0355aed9ba511480f18ba7ba577b47d6e771 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 5 Dec 2016 10:42:20 -0800 Subject: [PATCH] Fix for reset sensors while in desktop mode. Previously hitting ' a.k.a. reset sensors, would teleport you to the last position you were in before you switched into desktop mode, or the spawn location. This fixes that behavior but not re-centering the avatar while in desktop mode. --- interface/src/Application.cpp | 4 ++-- interface/src/Application.h | 2 +- interface/src/avatar/MyAvatar.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 76353104f4..f9db5a956e 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4745,13 +4745,13 @@ void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& regi renderArgs->_viewport = originalViewport; } -void Application::resetSensors(bool andReload) { +void Application::resetSensors(bool andRecenter) { DependencyManager::get()->reset(); DependencyManager::get()->reset(); DependencyManager::get()->reset(); getActiveDisplayPlugin()->resetSensors(); _overlayConductor.centerUI(); - getMyAvatar()->reset(andReload); + getMyAvatar()->reset(andRecenter); QMetaObject::invokeMethod(DependencyManager::get().data(), "reset", Qt::QueuedConnection); } diff --git a/interface/src/Application.h b/interface/src/Application.h index 5ab94465cc..a57fa1b02d 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -317,7 +317,7 @@ public slots: void openUrl(const QUrl& url) const; - void resetSensors(bool andReload = false); + void resetSensors(bool andRecenter = false); void setActiveFaceTracker() const; #if (PR_BUILD || DEV_BUILD) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 9a0b04aa6d..730a6d4a85 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -308,7 +308,7 @@ void MyAvatar::reset(bool andRecenter, bool andReload, bool andHead) { } setThrust(glm::vec3(0.0f)); - if (andRecenter) { + if (andRecenter && qApp->isHMDMode()) { // derive the desired body orientation from the *old* hmd orientation, before the sensor reset. auto newBodySensorMatrix = deriveBodyFromHMDSensor(); // Based on current cached HMD position/rotation..