got rid of velocity count, now use 'away' to trigger when to start computing the sit stand state

This commit is contained in:
amantley 2018-10-15 18:02:50 -07:00
parent 9ec999e15e
commit 49b869c5e3
2 changed files with 1 additions and 15 deletions

View file

@ -542,7 +542,7 @@ void MyAvatar::update(float deltaTime) {
// put update sit stand state counts here
if (!getIsSitStandStateLocked()) {
if (!getIsAway()) {
if ((_follow._velocityCount > VELOCITY_COUNT_THRESHOLD) || (qApp->isHMDMode() && (qApp->getActiveDisplayPlugin()->getName() == "Oculus Rift"))) {
if (qApp->isHMDMode()) {
if (getIsInSittingState()) {
if (newHeightReading.getTranslation().y > (STANDING_HEIGHT_MULTIPLE * _tippingPoint)) {
// if we recenter upwards then no longer in sitting state
@ -602,7 +602,6 @@ void MyAvatar::update(float deltaTime) {
// 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;
@ -4244,18 +4243,6 @@ void MyAvatar::FollowHelper::prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat
}
}
}
const int VELOCITY_COUNT_THRESHOLD = 60;
const float MINIMUM_HMD_VELOCITY = 0.1f;
if (_velocityCount > VELOCITY_COUNT_THRESHOLD) {
if (!isActive(Vertical) && (shouldActivateVertical(myAvatar, desiredBodyMatrix, currentBodyMatrix) || hasDriveInput)) {
activate(Vertical);
}
} else {
if ((glm::length(myAvatar.getControllerPoseInSensorFrame(controller::Action::HEAD).getVelocity()) > MINIMUM_HMD_VELOCITY)) {
_velocityCount++;
qCDebug(interfaceapp) << "velocity count is " << _velocityCount << " is away " << myAvatar.getIsAway() << " hmd mode "<< qApp->isHMDMode() << " " << qApp->getActiveDisplayPlugin()->getName();
}
}
} else {
if (!isActive(Rotation) && getForceActivateRotation()) {
activate(Rotation);

View file

@ -1760,7 +1760,6 @@ private:
std::atomic<bool> _forceActivateVertical { false };
std::atomic<bool> _forceActivateHorizontal { false };
std::atomic<bool> _toggleHipsFollowing { true };
int _velocityCount { 0 };
};
FollowHelper _follow;