Fix Position of Center Marker While in Seated Mode (#503)

* adjust so height adjusts when in drag

* removed height fix, half fixed center marker in seated

* fixed offset in seated mode
This commit is contained in:
ykeara
2020-08-11 20:03:09 -05:00
committed by GitHub
parent 15f5534f69
commit 90d980dcab
2 changed files with 34 additions and 9 deletions
+32 -8
View File
@@ -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 );
+2 -1
View File
@@ -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();