diff --git a/README.md b/README.md index 90cb83b..0950ab6 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,13 @@ Menu buttons: - the Timeout pose (as used in sports), registers as the system menu button +Swapped hands? + +when SteamVR confuses the left and right controller hands (which will be indicated by little hand icons shown near the bottom of the displayed Wand controllers), simply cross your hands the first time you bring them into view after starting SteamVR. This reverses the hand assignment and can improve the gaming experience for example in Audioshield. + + + + I am working on allowing to freely map gestures to buttons in the steamvr.vrsettings config file in your Steam\config folder. However note that the "leap_gestures" section is currently not parsed yet. It's merely a sign of things to come. ## Supported gestures diff --git a/drivers/driver_leap/driver_leap.cpp b/drivers/driver_leap/driver_leap.cpp index c518d92..26e8a26 100644 --- a/drivers/driver_leap/driver_leap.cpp +++ b/drivers/driver_leap/driver_leap.cpp @@ -652,7 +652,7 @@ CLeapHmdLatest::CLeapHmdLatest( vr::IServerDriverHost * pDriverHost, int base, i memset( &m_ControllerState, 0, sizeof( m_ControllerState ) ); memset( &m_Pose, 0, sizeof( m_Pose ) ); - m_Pose.result = vr::TrackingResult_Running_OK; + m_Pose.result = vr::TrackingResult_Uninitialized; m_firmware_revision = 0x0001; m_hardware_revision = 0x0001; @@ -929,9 +929,9 @@ void CLeapHmdLatest::UpdateControllerState(Frame &frame) NewState.unPacketNum = m_ControllerState.unPacketNum + 1; // system menu mapping (timeout gesture) - if (scores[GestureMatcher::Timeout] >= 0.8f) + if (scores[GestureMatcher::Timeout] >= 0.5f) NewState.ulButtonTouched |= vr::ButtonMaskFromId(vr::k_EButton_System); - if (scores[GestureMatcher::Timeout] >= 0.8f) + if (scores[GestureMatcher::Timeout] >= 0.5f) NewState.ulButtonPressed |= vr::ButtonMaskFromId(vr::k_EButton_System); // application menu mapping (Flat hand towards your face gesture) @@ -1277,11 +1277,14 @@ void CLeapHmdLatest::FinishRealignCoordinates(float(*m)[3], float *v ) if ( !pLeapA || !pLeapB ) return; - memcpy(pLeapA->m_hmdPos, &v[0], sizeof(m_hmdPos)); - memcpy(pLeapB->m_hmdPos, &v[0], sizeof(m_hmdPos)); - - pLeapA->m_hmdRot = pLeapB->m_hmdRot = CalculateRotation(m); + vr::HmdQuaternion_t q = CalculateRotation(m); + pLeapA->UpdateHmdPose(v, q); + pLeapB->UpdateHmdPose(v, q); +} - pLeapA->m_bCalibrated = true; - pLeapB->m_bCalibrated = true; +void CLeapHmdLatest::UpdateHmdPose(float *v, vr::HmdQuaternion_t q) +{ + memcpy(m_hmdPos, &v[0], sizeof(m_hmdPos)); + m_hmdRot = q; + m_bCalibrated = true; } diff --git a/drivers/driver_leap/driver_leap.h b/drivers/driver_leap/driver_leap.h index 9bf37ef..7f5822d 100644 --- a/drivers/driver_leap/driver_leap.h +++ b/drivers/driver_leap/driver_leap.h @@ -126,6 +126,7 @@ class CLeapHmdLatest : public vr::ITrackedDeviceServerDriver, public vr::IVRCont static void RealignCoordinates( CLeapHmdLatest * pLeapA, CLeapHmdLatest * pLeapB ); void FinishRealignCoordinates( float (*m)[3], float *v ); + void UpdateHmdPose(float *v, vr::HmdQuaternion_t q); uint32_t GetDeviceId() { return m_unSteamVRTrackedDeviceId; }