mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 19:56:44 +02:00
added the within threshold of height function and to do: the mode computation
This commit is contained in:
parent
3893b7e339
commit
7b49ae4950
1 changed files with 12 additions and 4 deletions
|
@ -3131,12 +3131,19 @@ static bool withinBaseOfSupport(glm::vec3 position) {
|
||||||
|
|
||||||
static bool headAngularVelocityBelowThreshold(glm::vec3 angularVelocity) {
|
static bool headAngularVelocityBelowThreshold(glm::vec3 angularVelocity) {
|
||||||
const float ANGULAR_VELOCITY_THRESHOLD = 0.3f;
|
const float ANGULAR_VELOCITY_THRESHOLD = 0.3f;
|
||||||
float xzPlaneAngularVelocity = glm::vec3(angularVelocity.x, 0.0f, angularVelocity.z).length();
|
glm::vec3 xzPlaneAngularVelocity(angularVelocity.x, 0.0f, angularVelocity.z);
|
||||||
bool isBelowThreshold = xzPlaneAngularVelocity < ANGULAR_VELOCITY_THRESHOLD;
|
float magnitudeAngularVelocity = glm::length(xzPlaneAngularVelocity);
|
||||||
qCDebug(interfaceapp) << "head velocity below threshold is: " << isBelowThreshold;
|
bool isBelowThreshold = (magnitudeAngularVelocity < ANGULAR_VELOCITY_THRESHOLD);
|
||||||
|
qCDebug(interfaceapp) << "magnitude " << magnitudeAngularVelocity << "head velocity below threshold is: " << isBelowThreshold;
|
||||||
|
qCDebug(interfaceapp) << "ang vel values x: " << angularVelocity.x << " y: " << angularVelocity.y << " z: " << angularVelocity.z;
|
||||||
return isBelowThreshold;
|
return isBelowThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool withinThresholdOfStandingHeightMode(float diffFromMode) {
|
||||||
|
const float MODE_HEIGHT_THRESHOLD = 0.3f;
|
||||||
|
return (diffFromMode < MODE_HEIGHT_THRESHOLD);
|
||||||
|
}
|
||||||
|
|
||||||
float MyAvatar::getUserHeight() const {
|
float MyAvatar::getUserHeight() const {
|
||||||
return _userHeight.get();
|
return _userHeight.get();
|
||||||
}
|
}
|
||||||
|
@ -3369,7 +3376,8 @@ void MyAvatar::FollowHelper::prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat
|
||||||
|
|
||||||
if (!isActive(Horizontal) && (getForceActivateHorizontal() ||
|
if (!isActive(Horizontal) && (getForceActivateHorizontal() ||
|
||||||
(!withinBaseOfSupport(myAvatar.getControllerPoseInAvatarFrame(controller::Action::HEAD).getTranslation()) &&
|
(!withinBaseOfSupport(myAvatar.getControllerPoseInAvatarFrame(controller::Action::HEAD).getTranslation()) &&
|
||||||
headAngularVelocityBelowThreshold(myAvatar.getControllerPoseInAvatarFrame(controller::Action::HEAD).getAngularVelocity())))) {
|
headAngularVelocityBelowThreshold(myAvatar.getControllerPoseInAvatarFrame(controller::Action::HEAD).getAngularVelocity()))) &&
|
||||||
|
withinThresholdOfStandingHeightMode(0.01f)) {
|
||||||
qCDebug(interfaceapp) << "----------------------------------------over the base of support";
|
qCDebug(interfaceapp) << "----------------------------------------over the base of support";
|
||||||
activate(Horizontal);
|
activate(Horizontal);
|
||||||
setForceActivateHorizontal(false);
|
setForceActivateHorizontal(false);
|
||||||
|
|
Loading…
Reference in a new issue