From 1e54d41f958a5e1023ab6241c89e85b9f6722915 Mon Sep 17 00:00:00 2001 From: Phil Palmer Date: Mon, 28 Dec 2020 05:37:06 -0500 Subject: [PATCH] Remove static variable from MyAvatar::update (made it a member). --- interface/src/avatar/MyAvatar.cpp | 9 +++------ interface/src/avatar/MyAvatar.h | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 86c6bcd0d8..a47cf088c6 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -676,12 +676,9 @@ void MyAvatar::update(float deltaTime) { } // Recenter the body when foot tracking starts or ends. - { - static bool prevFeetWereTracked = _isBodyPartTracked._feet; - if (_isBodyPartTracked._feet != prevFeetWereTracked) { - centerBodyInternal(false); - prevFeetWereTracked = _isBodyPartTracked._feet; - } + if (_isBodyPartTracked._feet != _isBodyPartTracked._feetPreviousUpdate) { + centerBodyInternal(false); + _isBodyPartTracked._feetPreviousUpdate = _isBodyPartTracked._feet; } // put the average hand azimuth into sensor space. diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 99d5759011..84913d0ad5 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -2733,6 +2733,7 @@ private: // Indicates which parts of the body are under direct control (tracked). struct { bool _feet{ false }; // Left or right foot. + bool _feetPreviousUpdate{ false };// Value of _feet on the previous update. bool _hips{ false }; bool _leftHand{ false }; bool _rightHand{ false };