mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 08:21:58 +02:00
addressed missing changes for luis
This commit is contained in:
parent
9bc92cb2a3
commit
2df9d6c5e9
2 changed files with 42 additions and 36 deletions
|
@ -530,6 +530,7 @@ void MyAvatar::update(float deltaTime) {
|
||||||
const float PERCENTAGE_WEIGHT_HEAD_VS_SHOULDERS_AZIMUTH = 0.0f; // 100 percent shoulders
|
const float PERCENTAGE_WEIGHT_HEAD_VS_SHOULDERS_AZIMUTH = 0.0f; // 100 percent shoulders
|
||||||
const float COSINE_THIRTY_DEGREES = 0.866f;
|
const float COSINE_THIRTY_DEGREES = 0.866f;
|
||||||
const float SQUATTY_TIMEOUT = 30.0f; // 30 seconds
|
const float SQUATTY_TIMEOUT = 30.0f; // 30 seconds
|
||||||
|
const float HEIGHT_FILTER_COEFFICIENT = 0.01f;
|
||||||
|
|
||||||
float tau = deltaTime / HMD_FACING_TIMESCALE;
|
float tau = deltaTime / HMD_FACING_TIMESCALE;
|
||||||
setHipToHandController(computeHandAzimuth());
|
setHipToHandController(computeHandAzimuth());
|
||||||
|
@ -559,7 +560,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);
|
||||||
_averageUserHeightSensorSpace = lerp(_averageUserHeightSensorSpace, newHeightReading.getTranslation().y, 0.01f);
|
_averageUserHeightSensorSpace = lerp(_averageUserHeightSensorSpace, newHeightReading.getTranslation().y, HEIGHT_FILTER_COEFFICIENT);
|
||||||
_recentModeReadings.insert(newHeightReadingInCentimeters);
|
_recentModeReadings.insert(newHeightReadingInCentimeters);
|
||||||
setCurrentStandingHeight(computeStandingHeightMode(newHeightReading));
|
setCurrentStandingHeight(computeStandingHeightMode(newHeightReading));
|
||||||
setAverageHeadRotation(computeAverageHeadRotation(getControllerPoseInAvatarFrame(controller::Action::HEAD)));
|
setAverageHeadRotation(computeAverageHeadRotation(getControllerPoseInAvatarFrame(controller::Action::HEAD)));
|
||||||
|
@ -4232,21 +4233,22 @@ bool MyAvatar::FollowHelper::shouldActivateVertical(const MyAvatar& myAvatar, co
|
||||||
|
|
||||||
if (myAvatar.getSitStandStateChange()) {
|
if (myAvatar.getSitStandStateChange()) {
|
||||||
returnValue = true;
|
returnValue = true;
|
||||||
}
|
|
||||||
if (myAvatar.getIsInSittingState()) {
|
|
||||||
if (myAvatar.getIsSitStandStateLocked()) {
|
|
||||||
returnValue = (offset.y > CYLINDER_TOP);
|
|
||||||
}
|
|
||||||
if (offset.y < SITTING_BOTTOM) {
|
|
||||||
// we recenter more easily when in sitting state.
|
|
||||||
returnValue = true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// in the standing state
|
if (myAvatar.getIsInSittingState()) {
|
||||||
returnValue = (offset.y > CYLINDER_TOP) || (offset.y < CYLINDER_BOTTOM);
|
if (myAvatar.getIsSitStandStateLocked()) {
|
||||||
// finally check for squats in standing
|
returnValue = (offset.y > CYLINDER_TOP);
|
||||||
if (_squatDetected) {
|
}
|
||||||
returnValue = true;
|
if (offset.y < SITTING_BOTTOM) {
|
||||||
|
// we recenter more easily when in sitting state.
|
||||||
|
returnValue = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// in the standing state
|
||||||
|
returnValue = (offset.y > CYLINDER_TOP) || (offset.y < CYLINDER_BOTTOM);
|
||||||
|
// finally check for squats in standing
|
||||||
|
if (_squatDetected) {
|
||||||
|
returnValue = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
|
|
|
@ -260,27 +260,31 @@ void setupPreferences() {
|
||||||
preferences->addPreference(preference);
|
preferences->addPreference(preference);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto getter = [myAvatar]()->int { switch (myAvatar->getUserRecenterModel()) {
|
auto getter = [myAvatar]()->int {
|
||||||
case MyAvatar::SitStandModelType::Auto:
|
switch (myAvatar->getUserRecenterModel()) {
|
||||||
default:
|
case MyAvatar::SitStandModelType::Auto:
|
||||||
return 0;
|
default:
|
||||||
case MyAvatar::SitStandModelType::ForceSit:
|
return 0;
|
||||||
return 1;
|
case MyAvatar::SitStandModelType::ForceSit:
|
||||||
case MyAvatar::SitStandModelType::DisableHMDLean:
|
return 1;
|
||||||
return 2;
|
case MyAvatar::SitStandModelType::DisableHMDLean:
|
||||||
}};
|
return 2;
|
||||||
auto setter = [myAvatar](int value) { switch (value) {
|
}
|
||||||
case 0:
|
};
|
||||||
default:
|
auto setter = [myAvatar](int value) {
|
||||||
myAvatar->setUserRecenterModel(MyAvatar::SitStandModelType::Auto);
|
switch (value) {
|
||||||
break;
|
case 0:
|
||||||
case 1:
|
default:
|
||||||
myAvatar->setUserRecenterModel(MyAvatar::SitStandModelType::ForceSit);
|
myAvatar->setUserRecenterModel(MyAvatar::SitStandModelType::Auto);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 1:
|
||||||
myAvatar->setUserRecenterModel(MyAvatar::SitStandModelType::DisableHMDLean);
|
myAvatar->setUserRecenterModel(MyAvatar::SitStandModelType::ForceSit);
|
||||||
break;
|
break;
|
||||||
}};
|
case 2:
|
||||||
|
myAvatar->setUserRecenterModel(MyAvatar::SitStandModelType::DisableHMDLean);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
auto preference = new RadioButtonsPreference(VR_MOVEMENT, "Auto / Force Sit / Disable Recenter", getter, setter);
|
auto preference = new RadioButtonsPreference(VR_MOVEMENT, "Auto / Force Sit / Disable Recenter", getter, setter);
|
||||||
QStringList items;
|
QStringList items;
|
||||||
items << "Auto - turns on avatar leaning when standing in real world" << "Seated - disables all avatar leaning while sitting in real world" << "Disabled - allows avatar sitting on the floor [Experimental]";
|
items << "Auto - turns on avatar leaning when standing in real world" << "Seated - disables all avatar leaning while sitting in real world" << "Disabled - allows avatar sitting on the floor [Experimental]";
|
||||||
|
|
Loading…
Reference in a new issue