Fix logic errors in redirected-walking (#413)
* Resolve a logic issue for Redirected Walking * Resolve issue with arc magnitudes being less than expected * warnings Co-authored-by: ykeara <ykeara1@gmail.com>
This commit is contained in:
@@ -97,10 +97,10 @@ void RotationTabController::doVestibularMotion(
|
|||||||
itr++ )
|
itr++ )
|
||||||
{
|
{
|
||||||
itrLast++;
|
itrLast++;
|
||||||
if ( itr->distance > itrLast->distance )
|
// if ( itr->distance > itrLast->distance )
|
||||||
{
|
//{
|
||||||
continue;
|
// continue;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if ( nearestWall == chaperoneDistances.end()
|
if ( nearestWall == chaperoneDistances.end()
|
||||||
|| itr->distance < nearestWall->distance )
|
|| itr->distance < nearestWall->distance )
|
||||||
@@ -135,19 +135,23 @@ void RotationTabController::doVestibularMotion(
|
|||||||
|
|
||||||
// Get the distance between previous and current
|
// Get the distance between previous and current
|
||||||
// position
|
// position
|
||||||
double distanceChange = std::sqrt(
|
double distanceChange = static_cast<double>(
|
||||||
std::pow( poseHmd.mDeviceToAbsoluteTracking.m[0][3]
|
std::hypot( poseHmd.mDeviceToAbsoluteTracking.m[0][3]
|
||||||
- m_autoTurnLastHmdUpdate.m[0][3],
|
|
||||||
2.0 )
|
|
||||||
+ std::pow( poseHmd.mDeviceToAbsoluteTracking.m[0][3]
|
|
||||||
- m_autoTurnLastHmdUpdate.m[0][3],
|
- m_autoTurnLastHmdUpdate.m[0][3],
|
||||||
2.0 ) );
|
poseHmd.mDeviceToAbsoluteTracking.m[2][3]
|
||||||
|
- m_autoTurnLastHmdUpdate.m[2][3] ) );
|
||||||
|
|
||||||
double rotationAmount
|
// Get the arc length between the previous point and current point
|
||||||
= ( distanceChange
|
// 2 sin-1( (d/2)/r ) (in radians)
|
||||||
/ ( 2.0 * M_PI
|
double arcLength = 2
|
||||||
* RotationTabController::vestibularMotionRadius() ) )
|
* std::asin( ( distanceChange / 2 )
|
||||||
* ( turnLeft ? 1 : -1 );
|
/ vestibularMotionRadius() );
|
||||||
|
if ( std::isnan( arcLength ) )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
double rotationAmount = arcLength * ( turnLeft ? 1 : -1 );
|
||||||
|
|
||||||
double newRotationAngleDeg
|
double newRotationAngleDeg
|
||||||
= std::fmod( parent->m_moveCenterTabController.rotation()
|
= std::fmod( parent->m_moveCenterTabController.rotation()
|
||||||
|
|||||||
Reference in New Issue
Block a user