Skip to content

Commit

Permalink
small refactoring and update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cbuchner1 committed May 1, 2016
1 parent 6d47a03 commit cbcb86f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 12 additions & 9 deletions drivers/driver_leap/driver_leap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions drivers/driver_leap/driver_leap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down

0 comments on commit cbcb86f

Please sign in to comment.