Showing the changes to interface/src/Application.cpp (1 of 13 files). Show all
Unified · Split
| @@ -1928,17 +1928,20 @@ void Application::updateAvatar(float deltaTime) { · 1927 unmodified lines | ||
| 1928 | 1928 | _headMouseY = min(_headMouseY, _glWidget->height()); |
| 1929 | 1929 | |
| 1930 | 1930 | const float MIDPOINT_OF_SCREEN = 0.5; |
| 1931 | − | |
| 1932 | − // Set lookAtPosition if an avatar is at the center of the screen | |
| 1933 | − glm::vec3 screenCenterRayOrigin, screenCenterRayDirection; | |
| 1934 | − _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection); | |
| 1935 | − | |
| 1936 | − glm::vec3 eyePosition; | |
| 1937 | 1931 | |
| 1938 | − _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition); | |
| 1939 | − if (_isLookingAtOtherAvatar) { | |
| 1940 | − glm::vec3 myLookAtFromMouse(eyePosition); | |
| 1941 | − _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); | |
| 1932 | + // Only use gyro to set lookAt if mouse hasn't selected an avatar | |
| 1933 | + if (!_isLookingAtOtherAvatar) { | |
| 1934 | + | |
| 1935 | + // Set lookAtPosition if an avatar is at the center of the screen | |
| 1936 | + glm::vec3 screenCenterRayOrigin, screenCenterRayDirection; | |
| 1937 | + _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection); | |
| 1938 | + | |
| 1939 | + glm::vec3 eyePosition; | |
| 1940 | + _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition); | |
| 1941 | + if (_isLookingAtOtherAvatar) { | |
| 1942 | + glm::vec3 myLookAtFromMouse(eyePosition); | |
| 1943 | + _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); | |
| 1944 | + } | |
| 1942 | 1945 | } |
| 1943 | 1946 | |
| 1944 | 1947 | } |
| @@ -2343,6 +2346,7 @@ void Application::displaySide(Camera& whichCamera) { · 398 unmodified lines | ||
| 2343 | 2346 | if (!avatar->isInitialized()) { |
| 2344 | 2347 | avatar->init(); |
| 2345 | 2348 | } |
| 2349 | + // Set lookAt to myCamera on client side if other avatars are looking at client | |
| 2346 | 2350 | if (isLookingAtMyAvatar(avatar)) { |
| 2347 | 2351 | avatar->getHead().setLookAtPosition(_myCamera.getPosition()); |
| 2348 | 2352 | } |
| @@ -3292,4 +3296,4 @@ void* Application::networkReceive(void* args) { · 943 unmodified lines | ||
| 3292 | 3296 | pthread_exit(0); |
| 3293 | 3297 | } |
| 3294 | 3298 | return NULL; |
| 3295 | −} | |
| 3299 | +} | |