Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -2016,6 +2016,17 @@ void Application::updateAvatar(float deltaTime) { · 2015 unmodified lines | ||
| 2016 | 2016 | _headMouseY = max(_headMouseY, 0); |
| 2017 | 2017 | _headMouseY = min(_headMouseY, _glWidget->height()); |
| 2018 | 2018 | |
| 2019 | + // Set lookAtPosition if an avatar is at the center of the screen | |
| 2020 | + | |
| 2021 | + glm::vec3 screenCenterRayOrigin, screenCenterRayDirection; | |
| 2022 | + _viewFrustum.computePickRay(0.5, 0.5, screenCenterRayOrigin, screenCenterRayDirection); | |
| 2023 | + | |
| 2024 | + glm::vec3 eyePosition; | |
| 2025 | + if (isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition)) { | |
| 2026 | + glm::vec3 myLookAtFromMouse(eyePosition); | |
| 2027 | + _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); | |
| 2028 | + } | |
| 2029 | + | |
| 2019 | 2030 | } |
| 2020 | 2031 | |
| 2021 | 2032 | if (OculusManager::isConnected()) { |