From 0e7692dfea0e8b42fe1e1a5a7dfa53e8b28b1d02 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Thu, 16 Jan 2014 16:59:50 -0800 Subject: [PATCH] When the mouse is hidden, just look straight forward. --- interface/src/Application.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 8812a3c49d..71f8648d23 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2080,17 +2080,23 @@ void Application::updateMyAvatarLookAtPosition(glm::vec3& lookAtSpot, glm::vec3& bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()"); + const float FAR_AWAY_STARE = TREE_SCALE; if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { lookAtSpot = _myCamera.getPosition(); + } else if (_mouseHidden) { + // if the mouse cursor is hidden, just look straight ahead + glm::vec3 rayOrigin, rayDirection; + _viewFrustum.computePickRay(0.5f, 0.5f, rayOrigin, rayDirection); + lookAtSpot = rayOrigin + rayDirection * FAR_AWAY_STARE; + } else if (!_lookatTargetAvatar) { if (_isHoverVoxel) { // Look at the hovered voxel lookAtSpot = getMouseVoxelWorldCoordinates(_hoverVoxel); } else { - // Just look in direction of the mouse ray - const float FAR_AWAY_STARE = TREE_SCALE; + // Just look in direction of the mouse ray lookAtSpot = lookAtRayOrigin + lookAtRayDirection * FAR_AWAY_STARE; } }