diff --git a/Readme.md b/Readme.md index 9ab3d1a..d8bcb1c 100644 --- a/Readme.md +++ b/Readme.md @@ -286,11 +286,13 @@ Allows users to temporarily move and rotate the center of the playspace. This al Motion Page - **Space Drag**: Allows shifting your playspace by dragging your controller, Binds must be set via SteamVR Input system. - - **Enable Left/Right Hand**: Toggles functionality (must be active in addition to binding via input system to work.) - - **Drag Comfort Mode**: Limits the rate at which your movement updates, reducing smoothness so that perceived motion starts to feel more like mini-teleports. Higher values reduce smoothness more. + - **Left/Right Hand**: Toggles functionality (must be active in addition to binding via input system to work.) + - **Comfort Mode**: Limits the rate at which your movement updates, reducing smoothness so that perceived motion starts to feel more like mini-teleports. Higher values reduce smoothness more. + - **Force Bounds**: Forces the display of the chaperone bounds during Space Drag. - **Space Turn**: Allows rotating your playspace by rotating your controller. Binds must be set via SteamVR Input system. - - **Enable Left/Right Hand**: Toggles functionality (must be active in addition to binding via input system to work.) - - **Turn Comfort Mode**: Limits the rate at which your rotation updates, reducing smoothness so that perceived rotation starts to feel more like mini-snap-turns. Higher values reduce smoothness more. + - **Left/Right Hand**: Toggles functionality (must be active in addition to binding via input system to work.) + - **Comfort Mode**: Limits the rate at which your rotation updates, reducing smoothness so that perceived rotation starts to feel more like mini-snap-turns. Higher values reduce smoothness more. + - **Force Bounds**: Forces the display of the chaperone bounds during Space Turn. - **Height Toggle**: Toggle between zero and an offset for gravity floor height. If gravity is inactive the user is also moved to this offset. (Example: allows for quick switching between a seated and standing height.) Can be bound via SteamVr Input System. - **On**: Current toggle state, Binds directly modify this. - **Height Offset**: The amount of the offset (+ is down.) diff --git a/docs/screenshots/MotionPage.png b/docs/screenshots/MotionPage.png index 768fde2..8505b38 100644 Binary files a/docs/screenshots/MotionPage.png and b/docs/screenshots/MotionPage.png differ diff --git a/src/res/qml/motion_page/space_drag/SpaceDragGroupBox.qml b/src/res/qml/motion_page/space_drag/SpaceDragGroupBox.qml index 0194089..07da636 100644 --- a/src/res/qml/motion_page/space_drag/SpaceDragGroupBox.qml +++ b/src/res/qml/motion_page/space_drag/SpaceDragGroupBox.qml @@ -34,7 +34,7 @@ GroupBox { MyToggleButton { id: moveShortcutLeft - text: "Enable Left Hand" + text: "Left Hand" onCheckedChanged: { MoveCenterTabController.moveShortcutLeft = this.checked } @@ -42,7 +42,7 @@ GroupBox { MyToggleButton { id: moveShortcutRight - text: "Enable Right Hand" + text: "Right Hand" onCheckedChanged: { MoveCenterTabController.moveShortcutRight = this.checked } @@ -53,7 +53,7 @@ GroupBox { } MyText { - text: "Drag Comfort Mode:" + text: "Comfort Mode:" horizontalAlignment: Text.AlignRight Layout.rightMargin: 10 } @@ -64,7 +64,7 @@ GroupBox { to: 10 stepSize: 1 value: 0 - Layout.preferredWidth: 200 + Layout.preferredWidth: 180 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight onValueChanged: { dragComfortText.text = dragComfortSlider.value @@ -79,6 +79,14 @@ GroupBox { Layout.preferredWidth: 30 Layout.rightMargin: 10 } + + MyToggleButton { + id: dragBounds + text: "Force Bounds" + onCheckedChanged: { + MoveCenterTabController.dragBounds = this.checked + } + } } } @@ -86,6 +94,7 @@ GroupBox { moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight dragComfortSlider.value = MoveCenterTabController.dragComfortFactor + dragBounds.checked = MoveCenterTabController.dragBounds } Connections { @@ -100,5 +109,8 @@ GroupBox { onDragComfortFactorChanged: { dragComfortSlider.value = MoveCenterTabController.dragComfortFactor } + onDragBoundsChanged: { + dragBounds.checked = MoveCenterTabController.dragBounds + } } } diff --git a/src/res/qml/motion_page/space_turn/SpaceTurnGroupBox.qml b/src/res/qml/motion_page/space_turn/SpaceTurnGroupBox.qml index c97af7c..78e53cb 100644 --- a/src/res/qml/motion_page/space_turn/SpaceTurnGroupBox.qml +++ b/src/res/qml/motion_page/space_turn/SpaceTurnGroupBox.qml @@ -34,7 +34,7 @@ GroupBox { MyToggleButton { id: turnBindLeft - text: "Enable Left Hand" + text: "Left Hand" onCheckedChanged: { MoveCenterTabController.turnBindLeft = this.checked } @@ -42,7 +42,7 @@ GroupBox { MyToggleButton { id: turnBindRight - text: "Enable Right Hand" + text: "Right Hand" onCheckedChanged: { MoveCenterTabController.turnBindRight = this.checked } @@ -53,7 +53,7 @@ GroupBox { } MyText { - text: "Turn Comfort Mode:" + text: "Comfort Mode:" horizontalAlignment: Text.AlignRight Layout.rightMargin: 10 } @@ -64,7 +64,7 @@ GroupBox { to: 10 stepSize: 1 value: 0 - Layout.preferredWidth: 200 + Layout.preferredWidth: 180 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight onValueChanged: { turnComfortText.text = turnComfortSlider.value @@ -79,6 +79,14 @@ GroupBox { Layout.preferredWidth: 30 Layout.rightMargin: 10 } + + MyToggleButton { + id: turnBounds + text: "Force Bounds" + onCheckedChanged: { + MoveCenterTabController.turnBounds = this.checked + } + } } } @@ -86,6 +94,7 @@ GroupBox { turnBindLeft.checked = MoveCenterTabController.turnBindLeft turnBindRight.checked = MoveCenterTabController.turnBindRight turnComfortSlider.value = MoveCenterTabController.turnComfortFactor + turnBounds.checked = MoveCenterTabController.turnBounds } Connections { @@ -100,5 +109,8 @@ GroupBox { onTurnComfortFactorChanged: { turnComfortSlider.value = MoveCenterTabController.turnComfortFactor } + onTurnBoundsChanged: { + turnBounds.checked = MoveCenterTabController.turnBounds + } } } diff --git a/src/tabcontrollers/FixFloorTabController.cpp b/src/tabcontrollers/FixFloorTabController.cpp index 3cea34c..3e2a031 100644 --- a/src/tabcontrollers/FixFloorTabController.cpp +++ b/src/tabcontrollers/FixFloorTabController.cpp @@ -221,6 +221,8 @@ void FixFloorTabController::eventLoopTick( setCanUndo( true ); state = 0; parent->m_moveCenterTabController.zeroOffsets(); + // this reset fixes a bug where fixed floor wouldn't show in WMR + parent->m_moveCenterTabController.reset(); } } } diff --git a/src/tabcontrollers/MoveCenterTabController.cpp b/src/tabcontrollers/MoveCenterTabController.cpp index b0e4f93..bec208d 100644 --- a/src/tabcontrollers/MoveCenterTabController.cpp +++ b/src/tabcontrollers/MoveCenterTabController.cpp @@ -68,6 +68,16 @@ void MoveCenterTabController::initStage1() { m_settingsRightHandTurnEnabled = value.toBool(); } + value = settings->value( "dragBounds", m_dragBounds ); + if ( value.isValid() && !value.isNull() ) + { + m_dragBounds = value.toBool(); + } + value = settings->value( "turnBounds", m_turnBounds ); + if ( value.isValid() && !value.isNull() ) + { + m_turnBounds = value.toBool(); + } value = settings->value( "dragComfortFactor", m_dragComfortFactor ); if ( value.isValid() && !value.isNull() ) { @@ -214,6 +224,14 @@ void MoveCenterTabController::outputLogSettings() { LOG( INFO ) << "LOADED SETTINGS: Universe-Centered Rotation Enabled"; } + if ( m_dragBounds ) + { + LOG( INFO ) << "LOADED SETTINGS: Space Drag Force Bounds Enabled"; + } + if ( m_turnBounds ) + { + LOG( INFO ) << "LOADED SETTINGS: Space Turn Force Bounds Enabled"; + } } void MoveCenterTabController::outputLogPoses() @@ -638,6 +656,62 @@ void MoveCenterTabController::setTurnBindRight( bool value, bool notify ) << m_settingsRightHandTurnEnabled; } +bool MoveCenterTabController::dragBounds() const +{ + return m_dragBounds; +} + +void MoveCenterTabController::setDragBounds( bool value, bool notify ) +{ + // detect deactivate + if ( m_dragBounds && !value ) + { + // set force bounds back to default on deactivate + vr::VRChaperone()->ForceBoundsVisible( + parent->m_chaperoneTabController.forceBounds() ); + } + m_dragBounds = value; + auto settings = OverlayController::appSettings(); + settings->beginGroup( "playspaceSettings" ); + settings->setValue( "dragBounds", m_dragBounds ); + settings->endGroup(); + settings->sync(); + if ( notify ) + { + emit dragBoundsChanged( m_dragBounds ); + } + LOG( INFO ) << "CHANGED SETTINGS: Space Drag Force Bounds set: " + << m_dragBounds; +} + +bool MoveCenterTabController::turnBounds() const +{ + return m_turnBounds; +} + +void MoveCenterTabController::setTurnBounds( bool value, bool notify ) +{ + // detect deactivate + if ( m_turnBounds && !value ) + { + // set force bounds back to default on deactivate + vr::VRChaperone()->ForceBoundsVisible( + parent->m_chaperoneTabController.forceBounds() ); + } + m_turnBounds = value; + auto settings = OverlayController::appSettings(); + settings->beginGroup( "playspaceSettings" ); + settings->setValue( "turnBounds", m_turnBounds ); + settings->endGroup(); + settings->sync(); + if ( notify ) + { + emit turnBoundsChanged( m_turnBounds ); + } + LOG( INFO ) << "CHANGED SETTINGS: Space Turn Force Bounds set: " + << m_turnBounds; +} + unsigned MoveCenterTabController::dragComfortFactor() const { return m_dragComfortFactor; @@ -2590,6 +2664,24 @@ void MoveCenterTabController::eventLoopTick( m_lastGravityUpdateTimePoint = std::chrono::steady_clock::now(); } + // force chaperone bounds visible if turn or drag settings require + if ( m_dragBounds + && m_activeDragHand != vr::TrackedControllerRole_Invalid ) + { + vr::VRChaperone()->ForceBoundsVisible( true ); + } + else if ( m_turnBounds + && m_activeTurnHand != vr::TrackedControllerRole_Invalid ) + { + vr::VRChaperone()->ForceBoundsVisible( true ); + } + // only set back to default every frame if setting is enabled + else if ( m_turnBounds || m_dragBounds ) + { + vr::VRChaperone()->ForceBoundsVisible( + parent->m_chaperoneTabController.forceBounds() ); + } + // Smooth turn motion can cause sim-sickness so we check if the user // wants to skip frames to reduce vection. We use the factor squared // because of logarithmic human perception. diff --git a/src/tabcontrollers/MoveCenterTabController.h b/src/tabcontrollers/MoveCenterTabController.h index 71eb4b1..884a060 100644 --- a/src/tabcontrollers/MoveCenterTabController.h +++ b/src/tabcontrollers/MoveCenterTabController.h @@ -48,6 +48,10 @@ class MoveCenterTabController : public QObject turnBindLeftChanged ) Q_PROPERTY( bool turnBindRight READ turnBindRight WRITE setTurnBindRight NOTIFY turnBindRightChanged ) + Q_PROPERTY( bool dragBounds READ dragBounds WRITE setDragBounds NOTIFY + dragBoundsChanged ) + Q_PROPERTY( bool turnBounds READ turnBounds WRITE setTurnBounds NOTIFY + turnBoundsChanged ) Q_PROPERTY( unsigned dragComfortFactor READ dragComfortFactor WRITE setDragComfortFactor NOTIFY dragComfortFactorChanged ) Q_PROPERTY( unsigned turnComfortFactor READ turnComfortFactor WRITE @@ -108,6 +112,8 @@ private: bool m_settingsRightHandTurnEnabled = false; unsigned m_dragComfortFactor = 0; unsigned m_turnComfortFactor = 0; + bool m_dragBounds = false; + bool m_turnBounds = false; bool m_heightToggle = false; float m_heightToggleOffset = -1.0f; float m_gravityFloor = 0.0f; @@ -203,6 +209,8 @@ public: bool moveShortcutLeft() const; bool turnBindRight() const; bool turnBindLeft() const; + bool dragBounds() const; + bool turnBounds() const; unsigned dragComfortFactor() const; unsigned turnComfortFactor() const; bool heightToggle() const; @@ -265,6 +273,8 @@ public slots: void setTurnBindLeft( bool value, bool notify = true ); void setDragComfortFactor( unsigned value, bool notify = true ); void setTurnComfortFactor( unsigned value, bool notify = true ); + void setDragBounds( bool value, bool notify = true ); + void setTurnBounds( bool value, bool notify = true ); void setHeightToggle( bool value, bool notify = true ); void setHeightToggleOffset( float value, bool notify = true ); void setGravityStrength( float value, bool notify = true ); @@ -304,6 +314,8 @@ signals: void moveShortcutLeftChanged( bool value ); void turnBindRightChanged( bool value ); void turnBindLeftChanged( bool value ); + void dragBoundsChanged( bool value ); + void turnBoundsChanged( bool value ); void dragComfortFactorChanged( unsigned value ); void turnComfortFactorChanged( unsigned value ); void heightToggleChanged( bool value );