From d8a32c8329208c1ad9d689caf1766068578d16c1 Mon Sep 17 00:00:00 2001 From: Anthony Thibault Date: Sun, 24 Apr 2016 17:59:51 -0700 Subject: [PATCH] Avatar eye gaze fix for HMDs When no avatars are chosen for more detailed eye gaze tracking the eyes should look straight ahead. Before this fix, if you were in room scale or not aligned with the camera sensor your gaze could drift to the left or to the right of your head's forward direction. Now it should follow your head more closely. --- interface/src/Application.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4071043c87..fcf1425287 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3104,10 +3104,8 @@ void Application::updateMyAvatarLookAtPosition() { } else { // I am not looking at anyone else, so just look forward if (isHMD) { - glm::mat4 headPose = myAvatar->getHMDSensorMatrix(); - glm::quat headRotation = glm::quat_cast(headPose); - lookAtSpot = myAvatar->getPosition() + - myAvatar->getOrientation() * (headRotation * glm::vec3(0.0f, 0.0f, -TREE_SCALE)); + glm::mat4 worldHMDMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix(); + lookAtSpot = transformPoint(worldHMDMat, glm::vec3(0.0f, 0.0f, -TREE_SCALE)); } else { lookAtSpot = myAvatar->getHead()->getEyePosition() + (myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE));