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:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user