Correct eye contact for Oculus users
Showing the changes to interface/src/Application.cpp (1 of 8 files). Show all
Unified · Split
| @@ -1997,8 +1997,16 @@ void Application::updateMyAvatarLookAtPosition() { · 1996 unmodified lines | ||
| 1997 | 1997 | glm::vec3 lookAtSpot; |
| 1998 | 1998 | if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 1999 | 1999 | // When I am in mirror mode, just look right at the camera (myself) |
| 2000 | − lookAtSpot = _myCamera.getPosition(); | |
| 2001 | − | |
| 2000 | + if (!OculusManager::isConnected()) { | |
| 2001 | + lookAtSpot = _myCamera.getPosition(); | |
| 2002 | + } else { | |
| 2003 | + if (_myAvatar->isLookingAtLeftEye()) { | |
| 2004 | + lookAtSpot = OculusManager::getLeftEyePosition(); | |
| 2005 | + } else { | |
| 2006 | + lookAtSpot = OculusManager::getRightEyePosition(); | |
| 2007 | + } | |
| 2008 | + } | |
| 2009 | + | |
| 2002 | 2010 | } else { |
| 2003 | 2011 | AvatarSharedPointer lookingAt = _myAvatar->getLookAtTargetAvatar().toStrongRef(); |
| 2004 | 2012 | if (lookingAt && _myAvatar != lookingAt.data()) { |
| @@ -2006,7 +2014,7 @@ void Application::updateMyAvatarLookAtPosition() { · 1 unmodified line | ||
| 2006 | 2014 | isLookingAtSomeone = true; |
| 2007 | 2015 | // If I am looking at someone else, look directly at one of their eyes |
| 2008 | 2016 | if (tracker) { |
| 2009 | − // If tracker active, look at the eye for the side my gaze is biased toward | |
| 2017 | + // If a face tracker is active, look at the eye for the side my gaze is biased toward | |
| 2010 | 2018 | if (tracker->getEstimatedEyeYaw() > _myAvatar->getHead()->getFinalYaw()) { |
| 2011 | 2019 | // Look at their right eye |
| 2012 | 2020 | lookAtSpot = static_cast<Avatar*>(lookingAt.data())->getHead()->getRightEyePosition(); |
| @@ -2016,7 +2024,11 @@ void Application::updateMyAvatarLookAtPosition() { · 3 unmodified lines | ||
| 2016 | 2024 | } |
| 2017 | 2025 | } else { |
| 2018 | 2026 | // Need to add randomly looking back and forth between left and right eye for case with no tracker |
| 2019 | − lookAtSpot = static_cast<Avatar*>(lookingAt.data())->getHead()->getEyePosition(); | |
| 2027 | + if (_myAvatar->isLookingAtLeftEye()) { | |
| 2028 | + lookAtSpot = static_cast<Avatar*>(lookingAt.data())->getHead()->getLeftEyePosition(); | |
| 2029 | + } else { | |
| 2030 | + lookAtSpot = static_cast<Avatar*>(lookingAt.data())->getHead()->getRightEyePosition(); | |
| 2031 | + } | |
| 2020 | 2032 | } |
| 2021 | 2033 | } else { |
| 2022 | 2034 | // I am not looking at anyone else, so just look forward |