added the correction code for when you are misslabeled as sitting while you are standing. It will now handle a sit down correctly. Also made the first approximation of state based on the average user height. This should use the user input of their height associated with their account

This commit is contained in:
amantley 2018-10-15 08:43:25 -07:00
parent 90c9e578c8
commit 8e272d6dd2
2 changed files with 13 additions and 1 deletions

View file

@ -546,6 +546,18 @@ void MyAvatar::update(float deltaTime) {
_averageUserHeightCount = 1;
setIsInSittingState(false);
}
} else if ((newHeightReading.getTranslation().y < (SITTING_HEIGHT_MULTIPLE * _tippingPoint)) && (angleSpine2 > COSINE_THIRTY_DEGREES)) {
_sitStandStateCount++;
if (_sitStandStateCount > SITTING_COUNT_THRESHOLD) {
_sitStandStateCount = 0;
_squatCount = 0;
if (newHeightReading.isValid()) {
_sumUserHeightSensorSpace = newHeightReading.getTranslation().y;
_tippingPoint = newHeightReading.getTranslation().y;
}
_averageUserHeightCount = 1;
setIsInSittingState(true);
}
} else {
_sitStandStateCount = 0;
// tipping point is average height when sitting.

View file

@ -1846,7 +1846,7 @@ private:
ThreadSafeValueCache<bool> _isInSittingState { false };
int _sitStandStateCount { 0 };
int _squatCount { 0 };
float _tippingPoint { DEFAULT_FLOOR_HEIGHT };
float _tippingPoint { DEFAULT_AVATAR_HEIGHT };
// load avatar scripts once when rig is ready
bool _shouldLoadScripts { false };