mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 10:19:06 +02:00
Fix for eye pitch, track blinking locally.
This commit is contained in:
parent
2c2f2fad5a
commit
f84d6f4f37
2 changed files with 36 additions and 29 deletions
|
@ -192,36 +192,43 @@ void Head::simulate(float deltaTime, bool isMine, float gyroCameraSensitivity) {
|
||||||
_browAudioLift *= 0.7f;
|
_browAudioLift *= 0.7f;
|
||||||
|
|
||||||
// update eyelid blinking
|
// update eyelid blinking
|
||||||
const float BLINK_SPEED = 10.0f;
|
Faceshift* faceshift = Application::getInstance()->getFaceshift();
|
||||||
const float FULLY_OPEN = 0.0f;
|
if (isMine && faceshift->isActive()) {
|
||||||
const float FULLY_CLOSED = 1.0f;
|
_leftEyeBlink = faceshift->getLeftBlink();
|
||||||
if (_leftEyeBlinkVelocity == 0.0f && _rightEyeBlinkVelocity == 0.0f) {
|
_rightEyeBlink = faceshift->getRightBlink();
|
||||||
// no blinking when brows are raised; blink less with increasing loudness
|
|
||||||
const float BASE_BLINK_RATE = 15.0f / 60.0f;
|
|
||||||
const float ROOT_LOUDNESS_TO_BLINK_INTERVAL = 0.25f;
|
|
||||||
if (forceBlink || (_browAudioLift < EPSILON && shouldDo(glm::max(1.0f, sqrt(_averageLoudness) *
|
|
||||||
ROOT_LOUDNESS_TO_BLINK_INTERVAL) / BASE_BLINK_RATE, deltaTime))) {
|
|
||||||
_leftEyeBlinkVelocity = BLINK_SPEED;
|
|
||||||
_rightEyeBlinkVelocity = BLINK_SPEED;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
_leftEyeBlink = glm::clamp(_leftEyeBlink + _leftEyeBlinkVelocity * deltaTime, FULLY_OPEN, FULLY_CLOSED);
|
const float BLINK_SPEED = 10.0f;
|
||||||
_rightEyeBlink = glm::clamp(_rightEyeBlink + _rightEyeBlinkVelocity * deltaTime, FULLY_OPEN, FULLY_CLOSED);
|
const float FULLY_OPEN = 0.0f;
|
||||||
|
const float FULLY_CLOSED = 1.0f;
|
||||||
if (_leftEyeBlink == FULLY_CLOSED) {
|
if (_leftEyeBlinkVelocity == 0.0f && _rightEyeBlinkVelocity == 0.0f) {
|
||||||
_leftEyeBlinkVelocity = -BLINK_SPEED;
|
// no blinking when brows are raised; blink less with increasing loudness
|
||||||
|
const float BASE_BLINK_RATE = 15.0f / 60.0f;
|
||||||
} else if (_leftEyeBlink == FULLY_OPEN) {
|
const float ROOT_LOUDNESS_TO_BLINK_INTERVAL = 0.25f;
|
||||||
_leftEyeBlinkVelocity = 0.0f;
|
if (forceBlink || (_browAudioLift < EPSILON && shouldDo(glm::max(1.0f, sqrt(_averageLoudness) *
|
||||||
}
|
ROOT_LOUDNESS_TO_BLINK_INTERVAL) / BASE_BLINK_RATE, deltaTime))) {
|
||||||
if (_rightEyeBlink == FULLY_CLOSED) {
|
_leftEyeBlinkVelocity = BLINK_SPEED;
|
||||||
_rightEyeBlinkVelocity = -BLINK_SPEED;
|
_rightEyeBlinkVelocity = BLINK_SPEED;
|
||||||
|
}
|
||||||
} else if (_rightEyeBlink == FULLY_OPEN) {
|
} else {
|
||||||
_rightEyeBlinkVelocity = 0.0f;
|
_leftEyeBlink = glm::clamp(_leftEyeBlink + _leftEyeBlinkVelocity * deltaTime, FULLY_OPEN, FULLY_CLOSED);
|
||||||
|
_rightEyeBlink = glm::clamp(_rightEyeBlink + _rightEyeBlinkVelocity * deltaTime, FULLY_OPEN, FULLY_CLOSED);
|
||||||
|
|
||||||
|
if (_leftEyeBlink == FULLY_CLOSED) {
|
||||||
|
_leftEyeBlinkVelocity = -BLINK_SPEED;
|
||||||
|
|
||||||
|
} else if (_leftEyeBlink == FULLY_OPEN) {
|
||||||
|
_leftEyeBlinkVelocity = 0.0f;
|
||||||
|
}
|
||||||
|
if (_rightEyeBlink == FULLY_CLOSED) {
|
||||||
|
_rightEyeBlinkVelocity = -BLINK_SPEED;
|
||||||
|
|
||||||
|
} else if (_rightEyeBlink == FULLY_OPEN) {
|
||||||
|
_rightEyeBlinkVelocity = 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// based on the nature of the lookat position, determine if the eyes can look / are looking at it.
|
// based on the nature of the lookat position, determine if the eyes can look / are looking at it.
|
||||||
if (USING_PHYSICAL_MOHAWK) {
|
if (USING_PHYSICAL_MOHAWK) {
|
||||||
updateHairPhysics(deltaTime);
|
updateHairPhysics(deltaTime);
|
||||||
|
|
|
@ -71,9 +71,9 @@ void Faceshift::readFromSocket() {
|
||||||
const float TRANSLATION_SCALE = 0.02f;
|
const float TRANSLATION_SCALE = 0.02f;
|
||||||
_headTranslation = glm::vec3(data.m_headTranslation.x, data.m_headTranslation.y,
|
_headTranslation = glm::vec3(data.m_headTranslation.x, data.m_headTranslation.y,
|
||||||
-data.m_headTranslation.z) * TRANSLATION_SCALE;
|
-data.m_headTranslation.z) * TRANSLATION_SCALE;
|
||||||
_eyeGazeLeftPitch = data.m_eyeGazeLeftPitch;
|
_eyeGazeLeftPitch = -data.m_eyeGazeLeftPitch;
|
||||||
_eyeGazeLeftYaw = data.m_eyeGazeLeftYaw;
|
_eyeGazeLeftYaw = data.m_eyeGazeLeftYaw;
|
||||||
_eyeGazeRightPitch = data.m_eyeGazeRightPitch;
|
_eyeGazeRightPitch = -data.m_eyeGazeRightPitch;
|
||||||
_eyeGazeRightYaw = data.m_eyeGazeRightYaw;
|
_eyeGazeRightYaw = data.m_eyeGazeRightYaw;
|
||||||
|
|
||||||
if (_leftBlinkIndex != -1) {
|
if (_leftBlinkIndex != -1) {
|
||||||
|
|
Loading…
Reference in a new issue