seperate recentering of playspace into it's own button
This commit is contained in:
@@ -15,7 +15,7 @@ void FixFloorTabController::initStage2(OverlayController * parent, QQuickWindow
|
||||
}
|
||||
|
||||
void FixFloorTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses) {
|
||||
if (state == 1) {
|
||||
if (state > 0) {
|
||||
if (measurementCount == 0) {
|
||||
// Get Controller ids for left/right hand
|
||||
auto leftId = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_LeftHand);
|
||||
@@ -107,10 +107,14 @@ void FixFloorTabController::eventLoopTick(vr::TrackedDevicePose_t* devicePoses)
|
||||
floorOffsetZ = tempOffsetZ;
|
||||
|
||||
LOG(INFO) << "Fix Floor and adjust playspace center: Floor Offset = [" << floorOffsetX << ", " << floorOffsetY << ", " << floorOffsetZ << "]";
|
||||
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 0, floorOffsetX, false);
|
||||
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 1, floorOffsetY, false);
|
||||
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 2, floorOffsetZ, false);
|
||||
statusMessage = "Fixing ... OK";
|
||||
float offset[3];
|
||||
offset[1] = floorOffsetY;
|
||||
if (state == 2) {
|
||||
offset[0] = floorOffsetX;
|
||||
offset[2] = floorOffsetZ;
|
||||
}
|
||||
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, offset, true);
|
||||
statusMessage = (state == 2) ? "Recentering ... Ok" : "Fixing ... OK";
|
||||
statusMessageTimeout = 1.0;
|
||||
emit statusMessageSignal();
|
||||
emit measureEndSignal();
|
||||
@@ -151,6 +155,15 @@ void FixFloorTabController::fixFloorClicked() {
|
||||
state = 1;
|
||||
}
|
||||
|
||||
void FixFloorTabController::recenterClicked() {
|
||||
statusMessage = "Fixing ...";
|
||||
statusMessageTimeout = 1.0;
|
||||
emit statusMessageSignal();
|
||||
emit measureStartSignal();
|
||||
measurementCount = 0;
|
||||
state = 2;
|
||||
}
|
||||
|
||||
void FixFloorTabController::undoFixFloorClicked() {
|
||||
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 0, -floorOffsetX, false);
|
||||
parent->AddOffsetToUniverseCenter(vr::TrackingUniverseStanding, 1, -floorOffsetY, false);
|
||||
|
||||
@@ -22,7 +22,7 @@ private:
|
||||
float controllerUpOffsetCorrection = 0.062f; // Controller touchpad facing upwards
|
||||
float controllerDownOffsetCorrection = 0.006f; // Controller touchpad facing downwards
|
||||
|
||||
int state = 0; // 0 .. idle, 1 .. measurement in progress
|
||||
int state = 0; // 0 .. idle, 1 .. floor fix in progress, 2 .. recenter in progress
|
||||
vr::TrackedDeviceIndex_t referenceController = vr::k_unTrackedDeviceIndexInvalid;
|
||||
unsigned measurementCount = 0;
|
||||
double tempOffsetX = 0.0;
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void fixFloorClicked();
|
||||
void recenterClicked();
|
||||
void undoFixFloorClicked();
|
||||
|
||||
void setCanUndo(bool value, bool notify = true);
|
||||
|
||||
Reference in New Issue
Block a user