Skip to content

Commit cde3a90

Browse files
committed
Fixes: Button codes and OpenXR, Unity movement by HadesVR
1 parent 5575bb2 commit cde3a90

File tree

2 files changed

+50
-8
lines changed

2 files changed

+50
-8
lines changed

OpenVR/FreeTrack/samples/driver_sample/driver_sample.cpp

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ int KeyNameToKeyCode(std::string KeyName) {
242242
else if (KeyName == "I") return 'I';
243243
else if (KeyName == "O") return 'O';
244244
else if (KeyName == "P") return 'P';
245-
else if (KeyName == "[") return '[';
246-
else if (KeyName == "]") return ']';
245+
else if (KeyName == "[") return 219;
246+
else if (KeyName == "]") return 221;
247247
else if (KeyName == "A") return 'A';
248248
else if (KeyName == "S") return 'S';
249249
else if (KeyName == "D") return 'D';
@@ -253,8 +253,8 @@ int KeyNameToKeyCode(std::string KeyName) {
253253
else if (KeyName == "J") return 'J';
254254
else if (KeyName == "K") return 'K';
255255
else if (KeyName == "L") return 'L';
256-
else if (KeyName == ";") return 186;
257-
else if (KeyName == "'") return 222;
256+
else if (KeyName == ":") return 186;
257+
else if (KeyName == "APOSTROPHE") return 222;
258258
else if (KeyName == "\\") return 220;
259259
else if (KeyName == "Z") return 'Z';
260260
else if (KeyName == "X") return 'X';
@@ -369,6 +369,24 @@ class CSampleDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IV
369369

370370
vr::VRProperties()->SetStringProperty( m_ulPropertyContainer, Prop_ModelNumber_String, m_sModelNumber.c_str() );
371371
vr::VRProperties()->SetStringProperty( m_ulPropertyContainer, Prop_RenderModelName_String, m_sModelNumber.c_str() );
372+
373+
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_SerialNumber_String, m_sSerialNumber.c_str());
374+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_WillDriftInYaw_Bool, false);
375+
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_ManufacturerName_String, "OpenVR-OpenTrack");
376+
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_TrackingFirmwareVersion_String, "1.0");
377+
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_HardwareRevision_String, "1.0");
378+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_DeviceIsWireless_Bool, false);
379+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_DeviceIsCharging_Bool, false);
380+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_CanUnifyCoordinateSystemWithHmd_Bool, true);
381+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_ContainsProximitySensor_Bool, false);
382+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_DeviceCanPowerOff_Bool, false);
383+
vr::VRProperties()->SetInt32Property(m_ulPropertyContainer, vr::Prop_DeviceClass_Int32, vr::TrackedDeviceClass_HMD);
384+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_HasCamera_Bool, false);
385+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_Firmware_ForceUpdateRequired_Bool, false);
386+
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, vr::Prop_RegisteredDeviceType_String, "HMD");
387+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_NeverTracked_Bool, false);
388+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_Identifiable_Bool, false);
389+
372390
vr::VRProperties()->SetFloatProperty( m_ulPropertyContainer, Prop_UserIpdMeters_Float, m_flIPD );
373391
vr::VRProperties()->SetFloatProperty( m_ulPropertyContainer, Prop_UserHeadToEyeDepthMeters_Float, 0.f );
374392
vr::VRProperties()->SetFloatProperty( m_ulPropertyContainer, Prop_DisplayFrequency_Float, m_flDisplayFrequency );
@@ -549,6 +567,9 @@ class CSampleDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IV
549567

550568
pose.qWorldFromDriverRotation = HmdQuaternion_Init(1, 0, 0, 0);
551569
pose.qDriverFromHeadRotation = HmdQuaternion_Init(1, 0, 0, 0);
570+
pose.shouldApplyHeadModel = true;
571+
pose.poseTimeOffset = 0;
572+
pose.willDriftInYaw = false;
552573

553574
if (HMDConnected) {
554575
//Set head tracking rotation

OpenVR/UDP/samples/driver_sample/driver_sample.cpp

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ int KeyNameToKeyCode(std::string KeyName) {
206206
else if (KeyName == "I") return 'I';
207207
else if (KeyName == "O") return 'O';
208208
else if (KeyName == "P") return 'P';
209-
else if (KeyName == "[") return '[';
210-
else if (KeyName == "]") return ']';
209+
else if (KeyName == "[") return 219;
210+
else if (KeyName == "]") return 221;
211211
else if (KeyName == "A") return 'A';
212212
else if (KeyName == "S") return 'S';
213213
else if (KeyName == "D") return 'D';
@@ -217,8 +217,8 @@ int KeyNameToKeyCode(std::string KeyName) {
217217
else if (KeyName == "J") return 'J';
218218
else if (KeyName == "K") return 'K';
219219
else if (KeyName == "L") return 'L';
220-
else if (KeyName == ";") return 186;
221-
else if (KeyName == "'") return 222;
220+
else if (KeyName == ":") return 186;
221+
else if (KeyName == "APOSTROPHE") return 222;
222222
else if (KeyName == "\\") return 220;
223223
else if (KeyName == "Z") return 'Z';
224224
else if (KeyName == "X") return 'X';
@@ -329,6 +329,24 @@ class CSampleDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IV
329329

330330
vr::VRProperties()->SetStringProperty( m_ulPropertyContainer, Prop_ModelNumber_String, m_sModelNumber.c_str() );
331331
vr::VRProperties()->SetStringProperty( m_ulPropertyContainer, Prop_RenderModelName_String, m_sModelNumber.c_str() );
332+
333+
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_SerialNumber_String, m_sSerialNumber.c_str());
334+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_WillDriftInYaw_Bool, false);
335+
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_ManufacturerName_String, "OpenVR-OpenTrack");
336+
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_TrackingFirmwareVersion_String, "1.0");
337+
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_HardwareRevision_String, "1.0");
338+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_DeviceIsWireless_Bool, false);
339+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_DeviceIsCharging_Bool, false);
340+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_CanUnifyCoordinateSystemWithHmd_Bool, true);
341+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_ContainsProximitySensor_Bool, false);
342+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_DeviceCanPowerOff_Bool, false);
343+
vr::VRProperties()->SetInt32Property(m_ulPropertyContainer, vr::Prop_DeviceClass_Int32, vr::TrackedDeviceClass_HMD);
344+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_HasCamera_Bool, false);
345+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_Firmware_ForceUpdateRequired_Bool, false);
346+
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, vr::Prop_RegisteredDeviceType_String, "HMD");
347+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_NeverTracked_Bool, false);
348+
vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_Identifiable_Bool, false);
349+
332350
vr::VRProperties()->SetFloatProperty( m_ulPropertyContainer, Prop_UserIpdMeters_Float, m_flIPD );
333351
vr::VRProperties()->SetFloatProperty( m_ulPropertyContainer, Prop_UserHeadToEyeDepthMeters_Float, 0.f );
334352
vr::VRProperties()->SetFloatProperty( m_ulPropertyContainer, Prop_DisplayFrequency_Float, m_flDisplayFrequency );
@@ -511,6 +529,9 @@ class CSampleDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IV
511529

512530
pose.qWorldFromDriverRotation = HmdQuaternion_Init(1, 0, 0, 0);
513531
pose.qDriverFromHeadRotation = HmdQuaternion_Init(1, 0, 0, 0);
532+
pose.shouldApplyHeadModel = true;
533+
pose.poseTimeOffset = 0;
534+
pose.willDriftInYaw = false;
514535

515536
//Set head tracking rotation
516537
pose.qRotation = EulerAngleToQuaternion(Roll, -Yaw, Pitch);

0 commit comments

Comments
 (0)