mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 14:12:50 +02:00
Merge branch 'reset-hud-on-driving' of https://github.com/howard-stearns/hifi into reset-hud-on-driving
This commit is contained in:
commit
2accccef9e
3 changed files with 5 additions and 14 deletions
|
@ -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();
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
void OculusBaseDisplayPlugin::resetSensors() {
|
||||
ovr_RecenterTrackingOrigin(_session);
|
||||
|
||||
_currentRenderFrameInfo.renderPose = glm::mat4(); // identity
|
||||
}
|
||||
|
||||
void OculusBaseDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
||||
|
|
|
@ -117,19 +117,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];
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue