Add a sanity check on space drag distance per frame

Limits space drag to 100m per frame. This is to address a bug where universe offset openvr clamping triggering a reset might send the play back out of bounds because an active hand drag repositioned them back there (moving the user either 1000m or 40,000m in a single frame.
This commit is contained in:
Kung-vr
2019-10-26 01:12:36 +09:00
parent cbe6678cae
commit 1a67b80ef3
@@ -1323,6 +1323,11 @@ void MoveCenterTabController::reset()
m_offsetY = 0.0f;
m_offsetZ = 0.0f;
m_rotation = 0;
m_lastControllerPosition[0] = 0.0f;
m_lastControllerPosition[1] = 0.0f;
m_lastControllerPosition[2] = 0.0f;
m_lastMoveHand = vr::TrackedControllerRole_Invalid;
m_lastRotateHand = vr::TrackedControllerRole_Invalid;
applyChaperoneResetData();
emit offsetXChanged( m_offsetX );
emit offsetYChanged( m_offsetY );
@@ -2546,6 +2551,14 @@ void MoveCenterTabController::updateHandDrag(
// offset is un-rotated coordinates
// prevent positional glitches from exceeding max openvr offset clamps.
// We do this by detecting a drag larger than 100m in a single frame.
if ( abs( diff[0] ) > 100.0 || abs( diff[1] ) > 100.0
|| abs( diff[2] ) > 100.0 )
{
reset();
}
// prevents updating if axis movement is locked
if ( !m_lockXToggle )
{