Patch WMR Floor Fix and add Force Bounds on motion (#237)

* Update FixFloorTabController.cpp

Adds an extra offsets tab reset after floor fix to make sure the fix is visible for WMR users.

* Add Force Bounds on Motion

Adds forcing chaperone bounds on space-turn and space-drag. Addresses #183

* Update Motion Page Screenshot for Force Bounds

* Update docs for Force Bounds on motion options
This commit is contained in:
Kung-vr
2019-07-03 15:15:18 -05:00
committed by ykeara
parent 4181b03232
commit 01a6d8d361
7 changed files with 144 additions and 12 deletions
+6 -4
View File
@@ -286,11 +286,13 @@ Allows users to temporarily move and rotate the center of the playspace. This al
<img src="docs/screenshots/MotionPage.png" width="600" alt="Motion Page"> <img src="docs/screenshots/MotionPage.png" width="600" alt="Motion Page">
- **Space Drag**: Allows shifting your playspace by dragging your controller, Binds must be set via SteamVR Input system. - **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.) - **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. - **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. - **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.) - **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. - **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. - **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. - **On**: Current toggle state, Binds directly modify this.
- **Height Offset**: The amount of the offset (+ is down.) - **Height Offset**: The amount of the offset (+ is down.)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 151 KiB

@@ -34,7 +34,7 @@ GroupBox {
MyToggleButton { MyToggleButton {
id: moveShortcutLeft id: moveShortcutLeft
text: "Enable Left Hand" text: "Left Hand"
onCheckedChanged: { onCheckedChanged: {
MoveCenterTabController.moveShortcutLeft = this.checked MoveCenterTabController.moveShortcutLeft = this.checked
} }
@@ -42,7 +42,7 @@ GroupBox {
MyToggleButton { MyToggleButton {
id: moveShortcutRight id: moveShortcutRight
text: "Enable Right Hand" text: "Right Hand"
onCheckedChanged: { onCheckedChanged: {
MoveCenterTabController.moveShortcutRight = this.checked MoveCenterTabController.moveShortcutRight = this.checked
} }
@@ -53,7 +53,7 @@ GroupBox {
} }
MyText { MyText {
text: "Drag Comfort Mode:" text: "Comfort Mode:"
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10 Layout.rightMargin: 10
} }
@@ -64,7 +64,7 @@ GroupBox {
to: 10 to: 10
stepSize: 1 stepSize: 1
value: 0 value: 0
Layout.preferredWidth: 200 Layout.preferredWidth: 180
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
onValueChanged: { onValueChanged: {
dragComfortText.text = dragComfortSlider.value dragComfortText.text = dragComfortSlider.value
@@ -79,6 +79,14 @@ GroupBox {
Layout.preferredWidth: 30 Layout.preferredWidth: 30
Layout.rightMargin: 10 Layout.rightMargin: 10
} }
MyToggleButton {
id: dragBounds
text: "Force Bounds"
onCheckedChanged: {
MoveCenterTabController.dragBounds = this.checked
}
}
} }
} }
@@ -86,6 +94,7 @@ GroupBox {
moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft moveShortcutLeft.checked = MoveCenterTabController.moveShortcutLeft
moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight moveShortcutRight.checked = MoveCenterTabController.moveShortcutRight
dragComfortSlider.value = MoveCenterTabController.dragComfortFactor dragComfortSlider.value = MoveCenterTabController.dragComfortFactor
dragBounds.checked = MoveCenterTabController.dragBounds
} }
Connections { Connections {
@@ -100,5 +109,8 @@ GroupBox {
onDragComfortFactorChanged: { onDragComfortFactorChanged: {
dragComfortSlider.value = MoveCenterTabController.dragComfortFactor dragComfortSlider.value = MoveCenterTabController.dragComfortFactor
} }
onDragBoundsChanged: {
dragBounds.checked = MoveCenterTabController.dragBounds
}
} }
} }
@@ -34,7 +34,7 @@ GroupBox {
MyToggleButton { MyToggleButton {
id: turnBindLeft id: turnBindLeft
text: "Enable Left Hand" text: "Left Hand"
onCheckedChanged: { onCheckedChanged: {
MoveCenterTabController.turnBindLeft = this.checked MoveCenterTabController.turnBindLeft = this.checked
} }
@@ -42,7 +42,7 @@ GroupBox {
MyToggleButton { MyToggleButton {
id: turnBindRight id: turnBindRight
text: "Enable Right Hand" text: "Right Hand"
onCheckedChanged: { onCheckedChanged: {
MoveCenterTabController.turnBindRight = this.checked MoveCenterTabController.turnBindRight = this.checked
} }
@@ -53,7 +53,7 @@ GroupBox {
} }
MyText { MyText {
text: "Turn Comfort Mode:" text: "Comfort Mode:"
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
Layout.rightMargin: 10 Layout.rightMargin: 10
} }
@@ -64,7 +64,7 @@ GroupBox {
to: 10 to: 10
stepSize: 1 stepSize: 1
value: 0 value: 0
Layout.preferredWidth: 200 Layout.preferredWidth: 180
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
onValueChanged: { onValueChanged: {
turnComfortText.text = turnComfortSlider.value turnComfortText.text = turnComfortSlider.value
@@ -79,6 +79,14 @@ GroupBox {
Layout.preferredWidth: 30 Layout.preferredWidth: 30
Layout.rightMargin: 10 Layout.rightMargin: 10
} }
MyToggleButton {
id: turnBounds
text: "Force Bounds"
onCheckedChanged: {
MoveCenterTabController.turnBounds = this.checked
}
}
} }
} }
@@ -86,6 +94,7 @@ GroupBox {
turnBindLeft.checked = MoveCenterTabController.turnBindLeft turnBindLeft.checked = MoveCenterTabController.turnBindLeft
turnBindRight.checked = MoveCenterTabController.turnBindRight turnBindRight.checked = MoveCenterTabController.turnBindRight
turnComfortSlider.value = MoveCenterTabController.turnComfortFactor turnComfortSlider.value = MoveCenterTabController.turnComfortFactor
turnBounds.checked = MoveCenterTabController.turnBounds
} }
Connections { Connections {
@@ -100,5 +109,8 @@ GroupBox {
onTurnComfortFactorChanged: { onTurnComfortFactorChanged: {
turnComfortSlider.value = MoveCenterTabController.turnComfortFactor turnComfortSlider.value = MoveCenterTabController.turnComfortFactor
} }
onTurnBoundsChanged: {
turnBounds.checked = MoveCenterTabController.turnBounds
}
} }
} }
@@ -221,6 +221,8 @@ void FixFloorTabController::eventLoopTick(
setCanUndo( true ); setCanUndo( true );
state = 0; state = 0;
parent->m_moveCenterTabController.zeroOffsets(); parent->m_moveCenterTabController.zeroOffsets();
// this reset fixes a bug where fixed floor wouldn't show in WMR
parent->m_moveCenterTabController.reset();
} }
} }
} }
@@ -68,6 +68,16 @@ void MoveCenterTabController::initStage1()
{ {
m_settingsRightHandTurnEnabled = value.toBool(); 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 ); value = settings->value( "dragComfortFactor", m_dragComfortFactor );
if ( value.isValid() && !value.isNull() ) if ( value.isValid() && !value.isNull() )
{ {
@@ -214,6 +224,14 @@ void MoveCenterTabController::outputLogSettings()
{ {
LOG( INFO ) << "LOADED SETTINGS: Universe-Centered Rotation Enabled"; 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() void MoveCenterTabController::outputLogPoses()
@@ -638,6 +656,62 @@ void MoveCenterTabController::setTurnBindRight( bool value, bool notify )
<< m_settingsRightHandTurnEnabled; << 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 unsigned MoveCenterTabController::dragComfortFactor() const
{ {
return m_dragComfortFactor; return m_dragComfortFactor;
@@ -2590,6 +2664,24 @@ void MoveCenterTabController::eventLoopTick(
m_lastGravityUpdateTimePoint = std::chrono::steady_clock::now(); 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 // 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 // wants to skip frames to reduce vection. We use the factor squared
// because of logarithmic human perception. // because of logarithmic human perception.
@@ -48,6 +48,10 @@ class MoveCenterTabController : public QObject
turnBindLeftChanged ) turnBindLeftChanged )
Q_PROPERTY( bool turnBindRight READ turnBindRight WRITE setTurnBindRight Q_PROPERTY( bool turnBindRight READ turnBindRight WRITE setTurnBindRight
NOTIFY turnBindRightChanged ) 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 Q_PROPERTY( unsigned dragComfortFactor READ dragComfortFactor WRITE
setDragComfortFactor NOTIFY dragComfortFactorChanged ) setDragComfortFactor NOTIFY dragComfortFactorChanged )
Q_PROPERTY( unsigned turnComfortFactor READ turnComfortFactor WRITE Q_PROPERTY( unsigned turnComfortFactor READ turnComfortFactor WRITE
@@ -108,6 +112,8 @@ private:
bool m_settingsRightHandTurnEnabled = false; bool m_settingsRightHandTurnEnabled = false;
unsigned m_dragComfortFactor = 0; unsigned m_dragComfortFactor = 0;
unsigned m_turnComfortFactor = 0; unsigned m_turnComfortFactor = 0;
bool m_dragBounds = false;
bool m_turnBounds = false;
bool m_heightToggle = false; bool m_heightToggle = false;
float m_heightToggleOffset = -1.0f; float m_heightToggleOffset = -1.0f;
float m_gravityFloor = 0.0f; float m_gravityFloor = 0.0f;
@@ -203,6 +209,8 @@ public:
bool moveShortcutLeft() const; bool moveShortcutLeft() const;
bool turnBindRight() const; bool turnBindRight() const;
bool turnBindLeft() const; bool turnBindLeft() const;
bool dragBounds() const;
bool turnBounds() const;
unsigned dragComfortFactor() const; unsigned dragComfortFactor() const;
unsigned turnComfortFactor() const; unsigned turnComfortFactor() const;
bool heightToggle() const; bool heightToggle() const;
@@ -265,6 +273,8 @@ public slots:
void setTurnBindLeft( bool value, bool notify = true ); void setTurnBindLeft( bool value, bool notify = true );
void setDragComfortFactor( unsigned value, bool notify = true ); void setDragComfortFactor( unsigned value, bool notify = true );
void setTurnComfortFactor( 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 setHeightToggle( bool value, bool notify = true );
void setHeightToggleOffset( float value, bool notify = true ); void setHeightToggleOffset( float value, bool notify = true );
void setGravityStrength( float value, bool notify = true ); void setGravityStrength( float value, bool notify = true );
@@ -304,6 +314,8 @@ signals:
void moveShortcutLeftChanged( bool value ); void moveShortcutLeftChanged( bool value );
void turnBindRightChanged( bool value ); void turnBindRightChanged( bool value );
void turnBindLeftChanged( bool value ); void turnBindLeftChanged( bool value );
void dragBoundsChanged( bool value );
void turnBoundsChanged( bool value );
void dragComfortFactorChanged( unsigned value ); void dragComfortFactorChanged( unsigned value );
void turnComfortFactorChanged( unsigned value ); void turnComfortFactorChanged( unsigned value );
void heightToggleChanged( bool value ); void heightToggleChanged( bool value );