diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-04-13 13:52:15 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-04-13 13:53:19 +0200 |
commit | 0fb51451aa193c3e1ca3560409b9de99aa36fd9b (patch) | |
tree | 454e856a2ef426c1b1c47737162d0176f1a6daab /tracker-steamvr | |
parent | 848daed37e7bab0eeec0eacc0333d7b7859cf3a6 (diff) |
tracker/steamvr: use normal center for controllers
Issue: #352
Diffstat (limited to 'tracker-steamvr')
-rw-r--r-- | tracker-steamvr/steamvr.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index fac0346a..80a71e1d 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -248,16 +248,26 @@ void steamvr::data(double* data) bool steamvr::center() { - with_vr_lock([&](vr_t v, error_t) + return with_vr_lock([&](vr_t v, error_t) { if (v) + { // Reset yaw and position v->ResetSeatedZeroPose(); + + if (v->GetTrackedDeviceClass(device_index) == vr::ETrackedDeviceClass::TrackedDeviceClass_HMD) + { + // Use chaperone universe real world up instead of opentrack's initial pose centering + // Note: Controllers will be centered based on initial headset position. + // TODO: may want to center controller/tracker yaw and position (only) when used alone + return true; + } + else + // with controllers, resetting the seated pose does nothing + return false; + } + return false; }); - // Use chaperone universe real world up instead of OpenTrack's initial pose centering - // Note: Controllers will be centered based on initial headset position. - // TODO: may want to center controller/tracker yaw and position (only) when used alone - return true; } void steamvr::matrix_to_euler(double& yaw, double& pitch, double& roll, const vr::HmdMatrix34_t& result) |