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.
This commit is contained in:
Anthony J. Thibault 2016-12-05 10:42:20 -08:00
parent 6cb85e92b1
commit 349f0355ae
3 changed files with 4 additions and 4 deletions

View file

@ -4745,13 +4745,13 @@ void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& regi
renderArgs->_viewport = originalViewport; renderArgs->_viewport = originalViewport;
} }
void Application::resetSensors(bool andReload) { void Application::resetSensors(bool andRecenter) {
DependencyManager::get<Faceshift>()->reset(); DependencyManager::get<Faceshift>()->reset();
DependencyManager::get<DdeFaceTracker>()->reset(); DependencyManager::get<DdeFaceTracker>()->reset();
DependencyManager::get<EyeTracker>()->reset(); DependencyManager::get<EyeTracker>()->reset();
getActiveDisplayPlugin()->resetSensors(); getActiveDisplayPlugin()->resetSensors();
_overlayConductor.centerUI(); _overlayConductor.centerUI();
getMyAvatar()->reset(andReload); getMyAvatar()->reset(andRecenter);
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "reset", Qt::QueuedConnection); QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "reset", Qt::QueuedConnection);
} }

View file

@ -317,7 +317,7 @@ public slots:
void openUrl(const QUrl& url) const; void openUrl(const QUrl& url) const;
void resetSensors(bool andReload = false); void resetSensors(bool andRecenter = false);
void setActiveFaceTracker() const; void setActiveFaceTracker() const;
#if (PR_BUILD || DEV_BUILD) #if (PR_BUILD || DEV_BUILD)

View file

@ -308,7 +308,7 @@ void MyAvatar::reset(bool andRecenter, bool andReload, bool andHead) {
} }
setThrust(glm::vec3(0.0f)); 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. // derive the desired body orientation from the *old* hmd orientation, before the sensor reset.
auto newBodySensorMatrix = deriveBodyFromHMDSensor(); // Based on current cached HMD position/rotation.. auto newBodySensorMatrix = deriveBodyFromHMDSensor(); // Based on current cached HMD position/rotation..