Merge pull request #9151 from hyperlogic/bug-fix/reset-sensor-in-desktop-mode

Fix for reset sensors while in desktop mode.
This commit is contained in:
Andrew Meadows 2016-12-05 13:46:53 -08:00 committed by GitHub
commit 119653bceb
3 changed files with 8 additions and 4 deletions

View file

@ -4733,13 +4733,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

@ -254,6 +254,10 @@ void MyAvatar::centerBody() {
return; return;
} }
if (!qApp->isHMDMode()) {
return;
}
// derive the desired body orientation from the current hmd orientation, before the sensor reset. // derive the desired body orientation from the current 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..
@ -308,7 +312,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..