diff --git a/src/tabcontrollers/MoveCenterTabController.cpp b/src/tabcontrollers/MoveCenterTabController.cpp index 18167bc..1b52497 100644 --- a/src/tabcontrollers/MoveCenterTabController.cpp +++ b/src/tabcontrollers/MoveCenterTabController.cpp @@ -1002,17 +1002,33 @@ void MoveCenterTabController::reset() m_lastControllerPosition[0] = 0.0f; m_lastControllerPosition[1] = 0.0f; m_lastControllerPosition[2] = 0.0f; - - // For Center Marker - if ( parent->m_chaperoneTabController.m_centerMarkerOverlayNeedsUpdate ) - { - m_offsetmatrix = utils::k_forwardUpMatrix; - parent->m_chaperoneTabController.updateCenterMarkerOverlay( - &m_offsetmatrix ); - } m_lastMoveHand = vr::TrackedControllerRole_Invalid; m_lastRotateHand = vr::TrackedControllerRole_Invalid; applyChaperoneResetData(); + + // For Center Marker + // Needs to happen after apply chaperone + if ( parent->m_chaperoneTabController.m_centerMarkerOverlayNeedsUpdate ) + { + m_offsetmatrix = utils::k_forwardUpMatrix; + if ( m_trackingUniverse == vr::TrackingUniverseSeated ) + { + vr::HmdMatrix34_t temp; + // This is not the floor it should be ~ chair height... this seems + // to be intended behaviour from openvr + vr::VRChaperoneSetup()->GetWorkingSeatedZeroPoseToRawTrackingPose( + &temp ); + m_offsetmatrix.m[1][3] = temp.m[1][3]; + // TODO check orientation + } + else + { + m_offsetmatrix.m[1][3] = 0; + } + parent->m_chaperoneTabController.updateCenterMarkerOverlay( + &m_offsetmatrix ); + } + emit offsetXChanged( m_offsetX ); emit offsetYChanged( m_offsetY ); emit offsetZChanged( m_offsetZ ); @@ -2803,11 +2819,19 @@ void MoveCenterTabController::updateSpace( bool forceUpdate ) // Rotates orientation At playspace center vr::HmdMatrix34_t finalmatrix; + utils::matMul33( finalmatrix, rotMatrix, m_offsetmatrix ); finalmatrix.m[0][3] = universePlayCenterTempCoords[0]; finalmatrix.m[1][3] = universePlayCenterTempCoords[1]; finalmatrix.m[2][3] = universePlayCenterTempCoords[2]; + if ( m_trackingUniverse == vr::TrackingUniverseSeated ) + { + vr::HmdMatrix34_t temp; + vr::VRChaperoneSetup()->GetWorkingSeatedZeroPoseToRawTrackingPose( + &temp ); + finalmatrix.m[1][3] += temp.m[1][3]; + } parent->m_chaperoneTabController.updateCenterMarkerOverlay( &finalmatrix ); diff --git a/src/tabcontrollers/MoveCenterTabController.h b/src/tabcontrollers/MoveCenterTabController.h index 826e0ba..6759c55 100644 --- a/src/tabcontrollers/MoveCenterTabController.h +++ b/src/tabcontrollers/MoveCenterTabController.h @@ -232,7 +232,6 @@ private: void updateGravity(); void updateSpace( bool forceUpdate = false ); void clampVelocity( double* velocity ); - void updateChaperoneResetData(); void applyChaperoneResetData(); void saveUncommittedChaperone(); void outputLogHmdMatrix( vr::HmdMatrix34_t hmdMatrix ); @@ -285,6 +284,8 @@ public: void setBoundsBasisHeight( float newHeight ); float getBoundsBasisMaxY(); + void updateChaperoneResetData(); + void reloadOffsetProfiles(); void saveOffsetProfiles(); Q_INVOKABLE unsigned getOffsetProfileCount();