put in condition for away mode so that when you take the hmd off and put it back on the initial guess to your state is made again.

This commit is contained in:
amantley 2018-10-15 09:52:34 -07:00
parent 8e272d6dd2
commit ae3ae9ce9a

View file

@ -530,8 +530,10 @@ void MyAvatar::update(float deltaTime) {
glm::vec3 worldHips = transformPoint(getTransform().getMatrix(), avatarHips);
glm::vec3 sensorHips = transformPoint(glm::inverse(getSensorToWorldMatrix()), worldHips);
const int VELOCITY_COUNT_THRESHOLD = 60;
// put update sit stand state counts here
if (!getIsSitStandStateLocked() && (_follow._velocityCount > 60)) {
if (!getIsSitStandStateLocked() && (_follow._velocityCount > VELOCITY_COUNT_THRESHOLD)) {
if (!getIsAway()) {
if (getIsInSittingState()) {
if (newHeightReading.getTranslation().y > (STANDING_HEIGHT_MULTIPLE * _tippingPoint)) {
// if we recenter upwards then no longer in sitting state
@ -583,6 +585,16 @@ void MyAvatar::update(float deltaTime) {
_sitStandStateCount = 0;
}
}
} else {
// if you are away then reset the average and set state to standing.
_squatCount = 0;
_sitStandStateCount = 0;
_follow._velocityCount = 0;
_averageUserHeightCount = 1;
_sumUserHeightSensorSpace = DEFAULT_AVATAR_HEIGHT;
_tippingPoint = DEFAULT_AVATAR_HEIGHT;
setIsInSittingState(false);
}
}
if (_drawAverageFacingEnabled) {