From a822de144cd679af6c27262d86884483b1fc634e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 4 Jul 2016 10:37:46 +0200 Subject: logic/tracker: get roll for camera centering from inertial centering It stays centered this way. Sadly yaw and pitch are still somewhat not fixed in the user's reference frame. --- opentrack-logic/tracker.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'opentrack-logic') diff --git a/opentrack-logic/tracker.cpp b/opentrack-logic/tracker.cpp index 6557b061..10512059 100644 --- a/opentrack-logic/tracker.cpp +++ b/opentrack-logic/tracker.cpp @@ -177,12 +177,17 @@ void Tracker::logic() rmat m_; switch (s.center_method) { + // inertial case 0: default: m_ = r * r_b.t(); break; + // relative case 1: - m_ = r_b.t() * r; + euler_t degs = rmat_to_euler(r_b.t() * r); + degs(2) = rmat_to_euler(r * r_b.t())(2); + m_ = euler_to_rmat(degs); + break; } const euler_t euler = r2d * rmat_to_euler(m_); -- cgit v1.2.3