From d7bd4cae9d420fc8d96319ae2c83b0659ff037d6 Mon Sep 17 00:00:00 2001 From: Stefano <stefano.dafarra@gmail.com> Date: Mon, 16 Sep 2024 14:48:34 +0200 Subject: [PATCH] Publishing the gaze direction insead of the position --- src/devices/openxrheadset/ExpressionsManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/devices/openxrheadset/ExpressionsManager.cpp b/src/devices/openxrheadset/ExpressionsManager.cpp index 09edecf..c5c6270 100644 --- a/src/devices/openxrheadset/ExpressionsManager.cpp +++ b/src/devices/openxrheadset/ExpressionsManager.cpp @@ -76,13 +76,13 @@ void ExpressionsManager::setGaze(const OpenXrInterface::Pose& headPose, const Op return; } - Eigen::Vector3f gazeInHead = headPose.rotation.inverse() * (gaze.position - headPose.position); + Eigen::Vector3f gazeDirectionInHead = headPose.rotation.inverse() * gaze.rotation * Eigen::Vector3f::UnitZ(); yarp::sig::Vector& gazeVector = m_gazePort.prepare(); gazeVector.resize(3); - gazeVector[0] = gazeInHead.x(); - gazeVector[1] = gazeInHead.y(); - gazeVector[2] = gazeInHead.z(); + gazeVector[0] = gazeDirectionInHead.x(); + gazeVector[1] = gazeDirectionInHead.y(); + gazeVector[2] = gazeDirectionInHead.z(); m_gazePort.write(); }