From 0bca9e75b02c7739b70e891c3b1e7e421c69f7a7 Mon Sep 17 00:00:00 2001 From: Guillaume Deshors Date: Tue, 2 Feb 2021 10:29:22 +0100 Subject: [PATCH] take into account headtracking offsets in the view --- src/Viewer/view.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Viewer/view.cxx b/src/Viewer/view.cxx index 99fa75a8e..9b949f673 100644 --- a/src/Viewer/view.cxx +++ b/src/Viewer/view.cxx @@ -748,6 +748,15 @@ static void getViewOffsets( offset.z() -= ViewPropertyEvaluator::getDoubleValue("(/sim/view[(/sim/current-view/view-number-raw)]/config/z-offset-m)"); offset_m += offset; } + + /* Handle headtracking : + Add offsets coming from the headtracker if there is one. The headtracker offsets have to be added ; they + cannot replace /sim/currentview/config/?-offset-m otherwise the offsets of each view are lost, making the + headtracking position unusable. */ + offset_m.x() += ViewPropertyEvaluator::getDoubleValue("(/sim/viewer/camera-offset-x)"); + offset_m.y() += ViewPropertyEvaluator::getDoubleValue("(/sim/viewer/camera-offset-y)"); + offset_m.z() += ViewPropertyEvaluator::getDoubleValue("(/sim/viewer/camera-offset-z)"); + } // recalculate for LookFrom view type...