mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 05:34:20 +02:00
more work on the mode function
This commit is contained in:
parent
61a935dbb5
commit
621ca7d2b4
2 changed files with 14 additions and 8 deletions
|
@ -3112,11 +3112,17 @@ static bool headAngularVelocityBelowThreshold(glm::vec3 angularVelocity) {
|
|||
<< " z: " << angularVelocity.z;
|
||||
return isBelowThreshold;
|
||||
}
|
||||
|
||||
/*
|
||||
bool MyAvatar::withinThresholdOfStandingHeightMode(float newReading) {
|
||||
bool MyAvatar::isWithinThresholdHeightMode(float newMode, float newReading) {
|
||||
const float MODE_HEIGHT_THRESHOLD = 0.3f;
|
||||
return newMode <
|
||||
}
|
||||
*/
|
||||
float MyAvatar::computeStandingHeightMode(float newReading) {
|
||||
const float CENTIMETERS_PER_METER = 100.0f;
|
||||
const float MODE_CORRECTION_FACTOR = 0.02f;
|
||||
const float MODE_HEIGHT_THRESHOLD = 0.3f;
|
||||
|
||||
|
||||
//first add the number to the mode array
|
||||
for (int i = 0; i < (SIZE_OF_MODE_ARRAY - 1); i++) {
|
||||
|
@ -3143,9 +3149,9 @@ bool MyAvatar::withinThresholdOfStandingHeightMode(float newReading) {
|
|||
return (newReading - MODE_CORRECTION_FACTOR);
|
||||
}
|
||||
}
|
||||
//return (diffFromMode < MODE_HEIGHT_THRESHOLD);
|
||||
return _currentMode;
|
||||
}
|
||||
*/
|
||||
|
||||
float MyAvatar::getUserHeight() const {
|
||||
return _userHeight.get();
|
||||
}
|
||||
|
@ -3377,7 +3383,7 @@ void MyAvatar::FollowHelper::prePhysicsUpdate(MyAvatar& myAvatar,
|
|||
}
|
||||
|
||||
headAngularVelocityBelowThreshold(myAvatar.getControllerPoseInAvatarFrame(controller::Action::HEAD).getAngularVelocity());
|
||||
|
||||
float temp = myAvatar.computeStandingHeightMode(0.01f);
|
||||
if (!isActive(Horizontal) && (getForceActivateHorizontal() ||
|
||||
(!withinBaseOfSupport(myAvatar.getControllerPoseInAvatarFrame(controller::Action::HEAD).getTranslation()) &&
|
||||
headAngularVelocityBelowThreshold(myAvatar.getControllerPoseInAvatarFrame(controller::Action::HEAD).getAngularVelocity())))){ //&&
|
||||
|
|
|
@ -49,8 +49,6 @@ enum AudioListenerMode {
|
|||
CUSTOM
|
||||
};
|
||||
|
||||
const int SIZE_OF_MODE_ARRAY = 50;
|
||||
|
||||
Q_DECLARE_METATYPE(AudioListenerMode);
|
||||
|
||||
class MyAvatar : public Avatar {
|
||||
|
@ -1027,7 +1025,8 @@ public:
|
|||
|
||||
bool isReadyForPhysics() const;
|
||||
|
||||
bool withinThresholdOfStandingHeightMode(float newReading);
|
||||
float computeStandingHeightMode(float newReading);
|
||||
//bool isWithinThresholdHeightMode(float newReading);
|
||||
|
||||
public slots:
|
||||
|
||||
|
@ -1634,6 +1633,7 @@ private:
|
|||
// load avatar scripts once when rig is ready
|
||||
bool _shouldLoadScripts { false };
|
||||
|
||||
static const int SIZE_OF_MODE_ARRAY = 50;
|
||||
bool _haveReceivedHeightLimitsFromDomain = { false };
|
||||
int _heightModeArray[SIZE_OF_MODE_ARRAY];
|
||||
int _currentMode = 0;
|
||||
|
|
Loading…
Reference in a new issue