From 9de5721a4882d021fc035db69c05e5cc170d0a09 Mon Sep 17 00:00:00 2001 From: "U-GAPOS\\andrew" Date: Wed, 4 Nov 2015 10:23:55 -0800 Subject: [PATCH] set _hmdFollowVelocity to zero when done following --- interface/src/avatar/MyAvatar.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 741a82fdb8..79d608640a 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1299,11 +1299,11 @@ void MyAvatar::prepareForPhysicsSimulation() { _characterController.setAvatarPositionAndOrientation(getPosition(), getOrientation()); if (qApp->isHMDMode()) { updateHMDFollowVelocity(); - _characterController.setHMDVelocity(_hmdFollowVelocity); - } else { - _characterController.setHMDVelocity(Vectors::ZERO); + } else if (_isFollowingHMD) { _isFollowingHMD = false; + _hmdFollowVelocity = Vectors::ZERO; } + _characterController.setHMDVelocity(_hmdFollowVelocity); } void MyAvatar::harvestResultsFromPhysicsSimulation() { @@ -1339,6 +1339,7 @@ void MyAvatar::adjustSensorTransform(glm::vec3 hmdShift) { // the "adjustment" is more or less complete so stop following _isFollowingHMD = false; _hmdFollowSpeed = 0.0f; + _hmdFollowVelocity = Vectors::ZERO; // and slam the body's transform anyway to eliminate any slight errors glm::vec3 finalBodyPosition = extractTranslation(worldBodyMatrix); nextAttitude(finalBodyPosition, finalBodyRotation);