Add x and z offset to recenter playspace during floor fix.
This commit is contained in:
committed by
Robin Appelman
parent
4e2a4bd570
commit
04687352df
@@ -62,7 +62,9 @@ void FixFloorTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto& m = devicePoses[referenceController].mDeviceToAbsoluteTracking.m;
|
auto& m = devicePoses[referenceController].mDeviceToAbsoluteTracking.m;
|
||||||
|
tempOffsetX = (double)m[0][3];
|
||||||
tempOffsetY = (double)m[1][3];
|
tempOffsetY = (double)m[1][3];
|
||||||
|
tempOffsetZ = (double)m[2][3];
|
||||||
/*
|
/*
|
||||||
| Intrinsic y-x'-z" rotation matrix:
|
| Intrinsic y-x'-z" rotation matrix:
|
||||||
| cr*cy+sp*sr*sy | cr*sp*sy-cy*sr | cp*sy |
|
| cr*cy+sp*sr*sy | cr*sp*sy-cy*sr | cp*sy |
|
||||||
@@ -96,12 +98,14 @@ void FixFloorTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses)
|
|||||||
|
|
||||||
if (measurementCount >= 25) {
|
if (measurementCount >= 25) {
|
||||||
if (std::abs(tempRoll) <= M_PI_2) {
|
if (std::abs(tempRoll) <= M_PI_2) {
|
||||||
floorOffset = tempOffsetY - controllerUpOffsetCorrection;
|
floorOffsetY = tempOffsetY - controllerUpOffsetCorrection;
|
||||||
} else {
|
} else {
|
||||||
floorOffset = tempOffsetY - controllerDownOffsetCorrection;
|
floorOffsetY = tempOffsetY - controllerDownOffsetCorrection;
|
||||||
}
|
}
|
||||||
LOG(INFO) << "Fix Floor: Floor Offset = " << floorOffset;
|
LOG(INFO) << "Fix Floor: Floor Offset = [" << floorOffsetX << ", " << floorOffsetY << ", " << floorOffsetZ << "]";
|
||||||
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 1, floorOffset, false);
|
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 0, floorOffsetX, false);
|
||||||
|
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 1, floorOffsetY, false);
|
||||||
|
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 2, floorOffsetZ, false);
|
||||||
statusMessage = "Fixing ... OK";
|
statusMessage = "Fixing ... OK";
|
||||||
statusMessageTimeout = 1.0;
|
statusMessageTimeout = 1.0;
|
||||||
emit statusMessageSignal();
|
emit statusMessageSignal();
|
||||||
@@ -144,9 +148,9 @@ void FixFloorTabController::fixFloorClicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FixFloorTabController::undoFixFloorClicked() {
|
void FixFloorTabController::undoFixFloorClicked() {
|
||||||
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 1, -floorOffset, false);
|
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 1, -floorOffsetY, false);
|
||||||
LOG(INFO) << "Fix Floor: Undo Floor Offset = " << -floorOffset;
|
LOG(INFO) << "Fix Floor: Undo Floor Offset = " << -floorOffsetY;
|
||||||
floorOffset = 0.0f;
|
floorOffsetY = 0.0f;
|
||||||
statusMessage = "Undo ... OK";
|
statusMessage = "Undo ... OK";
|
||||||
statusMessageTimeout = 1.0;
|
statusMessageTimeout = 1.0;
|
||||||
emit statusMessageSignal();
|
emit statusMessageSignal();
|
||||||
|
|||||||
@@ -25,9 +25,13 @@ private:
|
|||||||
int state = 0; // 0 .. idle, 1 .. measurement in progress
|
int state = 0; // 0 .. idle, 1 .. measurement in progress
|
||||||
vr::TrackedDeviceIndex_t referenceController = vr::k_unTrackedDeviceIndexInvalid;
|
vr::TrackedDeviceIndex_t referenceController = vr::k_unTrackedDeviceIndexInvalid;
|
||||||
unsigned measurementCount = 0;
|
unsigned measurementCount = 0;
|
||||||
|
double tempOffsetX = 0.0;
|
||||||
double tempOffsetY = 0.0;
|
double tempOffsetY = 0.0;
|
||||||
|
double tempOffsetZ = 0.0;
|
||||||
double tempRoll = 0.0;
|
double tempRoll = 0.0;
|
||||||
float floorOffset = 0.0f;
|
float floorOffsetX = 0.0f;
|
||||||
|
float floorOffsetY = 0.0f;
|
||||||
|
float floorOffsetZ = 0.0f;
|
||||||
QString statusMessage = "";
|
QString statusMessage = "";
|
||||||
float statusMessageTimeout = 0.0f;
|
float statusMessageTimeout = 0.0f;
|
||||||
bool m_canUndo = false;
|
bool m_canUndo = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user