mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:16:51 +02:00
changed the name of sumuserheightsensorspace to averageuserheightSensorSpace
This commit is contained in:
parent
baeccebfb9
commit
cd7af8b605
2 changed files with 9 additions and 9 deletions
|
@ -478,7 +478,7 @@ void MyAvatar::updateSitStandState(float newHeightReading, float angleHeadUp) {
|
||||||
// if we recenter upwards then no longer in sitting state
|
// if we recenter upwards then no longer in sitting state
|
||||||
_sitStandStateCount++;
|
_sitStandStateCount++;
|
||||||
if (_sitStandStateCount > STANDING_COUNT_THRESHOLD) {
|
if (_sitStandStateCount > STANDING_COUNT_THRESHOLD) {
|
||||||
_sumUserHeightSensorSpace = newHeightReading;
|
_averageUserHeightSensorSpace = newHeightReading;
|
||||||
_tippingPoint = newHeightReading;
|
_tippingPoint = newHeightReading;
|
||||||
setIsInSittingState(false);
|
setIsInSittingState(false);
|
||||||
}
|
}
|
||||||
|
@ -487,18 +487,18 @@ void MyAvatar::updateSitStandState(float newHeightReading, float angleHeadUp) {
|
||||||
// make sure that a real sit is still recognized so we won't be stuck in sitting unable to change state
|
// make sure that a real sit is still recognized so we won't be stuck in sitting unable to change state
|
||||||
_sitStandStateCount++;
|
_sitStandStateCount++;
|
||||||
if (_sitStandStateCount > SITTING_COUNT_THRESHOLD) {
|
if (_sitStandStateCount > SITTING_COUNT_THRESHOLD) {
|
||||||
_sumUserHeightSensorSpace = newHeightReading;
|
_averageUserHeightSensorSpace = newHeightReading;
|
||||||
_tippingPoint = newHeightReading;
|
_tippingPoint = newHeightReading;
|
||||||
// here we stay in sit state but reset the average height
|
// here we stay in sit state but reset the average height
|
||||||
setIsInSittingState(true);
|
setIsInSittingState(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// sanity check if average height greater than 5ft they are not sitting(or get off your dangerous barstool please)
|
// sanity check if average height greater than 5ft they are not sitting(or get off your dangerous barstool please)
|
||||||
if (_sumUserHeightSensorSpace > SITTING_UPPER_BOUND) {
|
if (_averageUserHeightSensorSpace > SITTING_UPPER_BOUND) {
|
||||||
setIsInSittingState(false);
|
setIsInSittingState(false);
|
||||||
} else {
|
} else {
|
||||||
// tipping point is average height when sitting.
|
// tipping point is average height when sitting.
|
||||||
_tippingPoint = _sumUserHeightSensorSpace;
|
_tippingPoint = _averageUserHeightSensorSpace;
|
||||||
_sitStandStateCount = 0;
|
_sitStandStateCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ void MyAvatar::updateSitStandState(float newHeightReading, float angleHeadUp) {
|
||||||
if (newHeightReading < (SITTING_HEIGHT_MULTIPLE * _tippingPoint)) {
|
if (newHeightReading < (SITTING_HEIGHT_MULTIPLE * _tippingPoint)) {
|
||||||
_sitStandStateCount++;
|
_sitStandStateCount++;
|
||||||
if (_sitStandStateCount > SITTING_COUNT_THRESHOLD) {
|
if (_sitStandStateCount > SITTING_COUNT_THRESHOLD) {
|
||||||
_sumUserHeightSensorSpace = newHeightReading;
|
_averageUserHeightSensorSpace = newHeightReading;
|
||||||
_tippingPoint = newHeightReading;
|
_tippingPoint = newHeightReading;
|
||||||
setIsInSittingState(true);
|
setIsInSittingState(true);
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,7 @@ void MyAvatar::updateSitStandState(float newHeightReading, float angleHeadUp) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if you are away then reset the average and set state to standing.
|
// if you are away then reset the average and set state to standing.
|
||||||
_sumUserHeightSensorSpace = _userHeight.get();
|
_averageUserHeightSensorSpace = _userHeight.get();
|
||||||
_tippingPoint = _userHeight.get();
|
_tippingPoint = _userHeight.get();
|
||||||
setIsInSittingState(false);
|
setIsInSittingState(false);
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,7 @@ void MyAvatar::update(float deltaTime) {
|
||||||
controller::Pose newHeightReading = getControllerPoseInSensorFrame(controller::Action::HEAD);
|
controller::Pose newHeightReading = getControllerPoseInSensorFrame(controller::Action::HEAD);
|
||||||
if (newHeightReading.isValid()) {
|
if (newHeightReading.isValid()) {
|
||||||
int newHeightReadingInCentimeters = glm::floor(newHeightReading.getTranslation().y * CENTIMETERS_PER_METER);
|
int newHeightReadingInCentimeters = glm::floor(newHeightReading.getTranslation().y * CENTIMETERS_PER_METER);
|
||||||
_sumUserHeightSensorSpace = lerp(_sumUserHeightSensorSpace, newHeightReading.getTranslation().y, 0.01f);
|
_averageUserHeightSensorSpace = lerp(_averageUserHeightSensorSpace, newHeightReading.getTranslation().y, 0.01f);
|
||||||
_recentModeReadings.insert(newHeightReadingInCentimeters);
|
_recentModeReadings.insert(newHeightReadingInCentimeters);
|
||||||
setCurrentStandingHeight(computeStandingHeightMode(newHeightReading));
|
setCurrentStandingHeight(computeStandingHeightMode(newHeightReading));
|
||||||
setAverageHeadRotation(computeAverageHeadRotation(getControllerPoseInAvatarFrame(controller::Action::HEAD)));
|
setAverageHeadRotation(computeAverageHeadRotation(getControllerPoseInAvatarFrame(controller::Action::HEAD)));
|
||||||
|
@ -3910,7 +3910,7 @@ void MyAvatar::setIsInSittingState(bool isSitting) {
|
||||||
void MyAvatar::setIsSitStandStateLocked(bool isLocked) {
|
void MyAvatar::setIsSitStandStateLocked(bool isLocked) {
|
||||||
_lockSitStandState.set(isLocked);
|
_lockSitStandState.set(isLocked);
|
||||||
_sitStandStateCount = 0;
|
_sitStandStateCount = 0;
|
||||||
_sumUserHeightSensorSpace = _userHeight.get();
|
_averageUserHeightSensorSpace = _userHeight.get();
|
||||||
_tippingPoint = _userHeight.get();
|
_tippingPoint = _userHeight.get();
|
||||||
if (!isLocked) {
|
if (!isLocked) {
|
||||||
// always start the auto transition mode in standing state.
|
// always start the auto transition mode in standing state.
|
||||||
|
|
|
@ -1832,7 +1832,7 @@ private:
|
||||||
|
|
||||||
// height of user in sensor space, when standing erect.
|
// height of user in sensor space, when standing erect.
|
||||||
ThreadSafeValueCache<float> _userHeight { DEFAULT_AVATAR_HEIGHT };
|
ThreadSafeValueCache<float> _userHeight { DEFAULT_AVATAR_HEIGHT };
|
||||||
float _sumUserHeightSensorSpace { _userHeight.get() };
|
float _averageUserHeightSensorSpace { _userHeight.get() };
|
||||||
bool _sitStandStateChange { false };
|
bool _sitStandStateChange { false };
|
||||||
ThreadSafeValueCache<bool> _lockSitStandState { false };
|
ThreadSafeValueCache<bool> _lockSitStandState { false };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue