From db2704836abd6c8d7d773b529c122c0c84d061f7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 23 May 2022 20:16:14 +0200 Subject: tracker/steamvr: adapt to openvr api changes --- tracker-steamvr/steamvr.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'tracker-steamvr') diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index 3bcfcc25..d3aaff77 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -216,9 +216,17 @@ module_status steamvr::start_tracker(QFrame*) err = tr("Can't find device with that serial"); if (err.isEmpty()) - return status_ok(); - else - return error(err); + { + if (auto* c = vr::VRCompositor(); c != nullptr) + { + c->SetTrackingSpace(origin::TrackingUniverseSeated); + return status_ok(); + } + else + return error("vr::VRCompositor == NULL"); + } + + return error(err); }); } @@ -253,8 +261,11 @@ bool steamvr::center() { if (v->GetTrackedDeviceClass(device_index) == vr::ETrackedDeviceClass::TrackedDeviceClass_HMD) { - // Reset yaw and position - v->ResetSeatedZeroPose(); + auto* c = vr::VRChaperone(); + if (!c) + eval_once(qDebug() << "vr::VRChaperone == NULL"); + else + c->ResetZeroPose(origin::TrackingUniverseSeated); // Use chaperone universe real world up instead of opentrack's initial pose centering // Note: Controllers will be centered based on initial headset position. -- cgit v1.2.3