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