mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 06:24:41 +02:00
When Faceshift is active, use its eye directions rather than the mouse ray.
This commit is contained in:
parent
697484d0bb
commit
0d593c4a3f
1 changed files with 11 additions and 1 deletions
|
@ -1518,7 +1518,17 @@ void Application::update(float deltaTime) {
|
||||||
// Set where I am looking based on my mouse ray (so that other people can see)
|
// Set where I am looking based on my mouse ray (so that other people can see)
|
||||||
glm::vec3 lookAtSpot;
|
glm::vec3 lookAtSpot;
|
||||||
|
|
||||||
_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, lookAtSpot);
|
// if we have faceshift, use that to compute the lookat direction
|
||||||
|
glm::vec3 lookAtRayOrigin = mouseRayOrigin, lookAtRayDirection = mouseRayDirection;
|
||||||
|
if (_faceshift.isActive()) {
|
||||||
|
lookAtRayOrigin = _myAvatar.getHead().calculateAverageEyePosition();
|
||||||
|
float averagePitch = (_faceshift.getEyeGazeLeftPitch() + _faceshift.getEyeGazeRightPitch()) / 2.0f;
|
||||||
|
float averageYaw = (_faceshift.getEyeGazeLeftYaw() + _faceshift.getEyeGazeRightYaw()) / 2.0f;
|
||||||
|
lookAtRayDirection = _myAvatar.getHead().getOrientation() *
|
||||||
|
glm::quat(glm::vec3(averagePitch, averageYaw, 0.0f)) * glm::vec3(0.0f, 0.0f, -1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
_isLookingAtOtherAvatar = isLookingAtOtherAvatar(lookAtRayOrigin, lookAtRayDirection, lookAtSpot);
|
||||||
if (_isLookingAtOtherAvatar) {
|
if (_isLookingAtOtherAvatar) {
|
||||||
// If the mouse is over another avatar's head...
|
// If the mouse is over another avatar's head...
|
||||||
_myAvatar.getHead().setLookAtPosition(lookAtSpot);
|
_myAvatar.getHead().setLookAtPosition(lookAtSpot);
|
||||||
|
|
Loading…
Reference in a new issue