From a77f888f1574589f802daa62b373499858e5d7cb Mon Sep 17 00:00:00 2001 From: "U-GAPOS\\andrew" Date: Mon, 2 Nov 2015 11:29:17 -0800 Subject: [PATCH] more correct HMD offset correction velocity --- 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 3bf1b79902..00870c62c6 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -365,15 +365,16 @@ void MyAvatar::updateHMDFollowVelocity() { // compute offset to body's target position (in sensor-frame) auto sensorBodyMatrix = deriveBodyFromHMDSensor(); _hmdFollowOffset = extractTranslation(sensorBodyMatrix) - extractTranslation(_bodySensorMatrix); - if (_hmdFollowOffset.y < 0.0f) { + glm::vec3 truncatedOffset = _hmdFollowOffset; + if (truncatedOffset.y < 0.0f) { // don't pull the body DOWN to match the target (allow animation system to squat) - _hmdFollowOffset.y = 0.0f; + truncatedOffset.y = 0.0f; } bool needNewFollowSpeed = (_isFollowingHMD && _hmdFollowSpeed == 0.0f); if (!needNewFollowSpeed) { // check to see if offset has exceeded its threshold - float distance = glm::length(_hmdFollowOffset); + float distance = glm::length(truncatedOffset); const float MAX_HMD_HIP_SHIFT = 0.2f; if (distance > MAX_HMD_HIP_SHIFT) { _isFollowingHMD = true;