From 097b16aadc5e0f135e2df0a93a6bf7a939abccbe Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 23 May 2016 15:40:29 -0700 Subject: [PATCH 1/3] Fix for sensor reset on oculus. --- plugins/oculus/src/OculusBaseDisplayPlugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp index a92c5b5b22..3b6545ae96 100644 --- a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp +++ b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp @@ -13,6 +13,8 @@ void OculusBaseDisplayPlugin::resetSensors() { ovr_RecenterTrackingOrigin(_session); + + _currentRenderFrameInfo.renderPose = glm::mat4(); // identity } void OculusBaseDisplayPlugin::beginFrameRender(uint32_t frameIndex) { From f82c3ba4f2e39e106a634d637c9ebbcbc585cb4a Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 23 May 2016 16:30:05 -0700 Subject: [PATCH 2/3] Revert "OpenVRDispalyPlugin: fix one-frame lag in resetSensors." This reverts commit 8381e74fb3478750362de176aa0710b369469c0f. --- plugins/openvr/src/OpenVrDisplayPlugin.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.cpp b/plugins/openvr/src/OpenVrDisplayPlugin.cpp index 1f6b11f862..38719fdca5 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.cpp +++ b/plugins/openvr/src/OpenVrDisplayPlugin.cpp @@ -122,19 +122,7 @@ void OpenVrDisplayPlugin::customizeContext() { void OpenVrDisplayPlugin::resetSensors() { Lock lock(_poseMutex); glm::mat4 m = toGlm(_trackedDevicePose[0].mDeviceToAbsoluteTracking); - - glm::mat4 oldSensorResetMat = _sensorResetMat; _sensorResetMat = glm::inverse(cancelOutRollAndPitch(m)); - - glm::mat4 undoRedoMat = _sensorResetMat * glm::inverse(oldSensorResetMat); - - // update the device poses, by undoing the previous sensorResetMatrix then applying the new one. - for (int i = 0; i < vr::k_unMaxTrackedDeviceCount; i++) { - _trackedDevicePoseMat4[i] = undoRedoMat * _trackedDevicePoseMat4[i]; - _trackedDeviceLinearVelocities[i] = transformVectorFast(undoRedoMat, _trackedDeviceLinearVelocities[i]); - _trackedDeviceAngularVelocities[i] = transformVectorFast(undoRedoMat, _trackedDeviceAngularVelocities[i]); - } - _currentRenderFrameInfo.renderPose = _trackedDevicePoseMat4[vr::k_unTrackedDeviceIndex_Hmd]; } From edfce0d5badcac66e0b857c24b47875c37d33b04 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 23 May 2016 16:34:19 -0700 Subject: [PATCH 3/3] MyAvatar: reset fix, for both oculus and vive --- interface/src/avatar/MyAvatar.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 2505e258ed..12d2764e74 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -263,8 +263,9 @@ void MyAvatar::reset(bool andRecenter, bool andReload) { setPosition(worldBodyPos); setOrientation(worldBodyRot); - // now sample the new hmd orientation AFTER sensor reset. - updateFromHMDSensorMatrix(qApp->getHMDSensorPose()); + // now sample the new hmd orientation AFTER sensor reset, which should be identity. + glm::mat4 identity; + updateFromHMDSensorMatrix(identity); // update the body in sensor space using the new hmd sensor sample _bodySensorMatrix = deriveBodyFromHMDSensor();