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
@@ -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.