diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusHandControllerDataProviderProfile.asset b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusHandControllerDataProviderProfile.asset index dcaeb81..a401172 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusHandControllerDataProviderProfile.asset +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusHandControllerDataProviderProfile.asset @@ -14,10 +14,11 @@ MonoBehaviour: m_EditorClassIdentifier: hasSetupDefaults: 1 controllerMappingProfiles: - - {fileID: 11400000, guid: b43ff1b6f37e65946b1abc7e50af105f, type: 2} - - {fileID: 11400000, guid: 6c775257f26873e459a492f28125e129, type: 2} - handMeshingEnabled: 0 + - {fileID: 11400000, guid: dd499836e4b82f14da2f414aad1fed8b, type: 2} + - {fileID: 11400000, guid: 78bf44d2b6970a74ea2721883b0b22bc, type: 2} + renderingMode: 1 handPhysicsEnabled: 0 useTriggers: 0 boundsMode: 0 + trackedPoses: [] minConfidenceRequired: 0 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController.meta new file mode 100644 index 0000000..f851637 --- /dev/null +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1b4d2bf8adc9c1c42a2476f8cc716b09 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left.meta index 4fd38c5..a06d79b 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 766b73f69c2ec87418a5c622ae4472e9 +guid: 7d3625a1084aca940a63c35a581cf412 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryHandTriggerPressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryHandTriggerPressProfile.asset.meta index 43c535c..9ae946f 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryHandTriggerPressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryHandTriggerPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4e6ca112a89bc8a4da89d367f0972644 +guid: fdcc142fd435d81449934f1c47f2c7e6 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryHandTriggerProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryHandTriggerProfile.asset.meta index d69bc2f..a387dd2 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryHandTriggerProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryHandTriggerProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b62bdd20dc750f84e95524a5ed7d4a95 +guid: 15b05a8a0a9d281448ab94b8bf549e60 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerNearTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerNearTouchProfile.asset.meta index e93f420..a87adc6 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerNearTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerNearTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9eada80ad9c3f0c478db97cacea7f982 +guid: dd799fbfb54e7c84dae7323ba609276f NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerPressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerPressProfile.asset.meta index 891d181..e109bac 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerPressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6684da1c5537924408242aeb09a96722 +guid: 9947f38f310de894c9a897f071cade52 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerProfile.asset.meta index 146d2c4..1c86459 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 078df0b10d3e1074aa9976f4f928f38a +guid: 9bbed734892721644b6da3bd9c1f7b33 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerTouchProfile.asset.meta index 6486384..f24e824 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis1D.PrimaryIndexTriggerTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ba4b36566bff5d4458c382a5f8e2de42 +guid: d85c1e429b274984faa59055b93190ff NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis2D.PrimaryThumbRestProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis2D.PrimaryThumbRestProfile.asset.meta index e0dde89..e645cff 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis2D.PrimaryThumbRestProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis2D.PrimaryThumbRestProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5f2c3f2b7b17e8447b5cb3671f5089f4 +guid: fb9b971cf238bb4449528a3b93906c0a NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis2D.PrimaryThumbstickProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis2D.PrimaryThumbstickProfile.asset.meta index 025a3d6..cddda02 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis2D.PrimaryThumbstickProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Axis2D.PrimaryThumbstickProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8d73d3132335ac94b88a13f1de60c5ec +guid: a62d36f527a475448bce7121320d2e65 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.FourPressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.FourPressProfile.asset.meta index 8cf6fed..97e6435 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.FourPressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.FourPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 70d4b454d4d7bd54184fffbfc81f5218 +guid: 7bf684345285a0a4b86a5fd728f337b9 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.FourTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.FourTouchProfile.asset.meta index 3a885b9..12f2530 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.FourTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.FourTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 443ada4c65fe2ac4a875bcd77403e738 +guid: 38d92e59b53a61541beea419e3c9e65c NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickNearTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickNearTouchProfile.asset.meta index 9c20069..789dec8 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickNearTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickNearTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: eef5b794e9afa6d4588670577951c8cf +guid: fd37d827948d19e4287dc0cba0cee5fd NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickPressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickPressProfile.asset.meta index 92fd666..8323ca4 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickPressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 80f56a87a099e6f4281aaa6a6c6bdfaa +guid: 108fcaa8f8b1b334f9e7c962dc72e975 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickTouchProfile.asset.meta index 7aca38f..c4d21ac 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.PrimaryThumbstickTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 71af88ada0f87b6408b687dfe017f671 +guid: 5dacfe2e20ed1f74fb6b024adaa96243 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.StartPressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.StartPressProfile.asset.meta index ca3d81d..9cd1b61 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.StartPressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.StartPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0607425e4bb401441be2af20781aa40a +guid: 030560660c2f6d442a305ecc72e0b461 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.ThreePressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.ThreePressProfile.asset.meta index 117b484..c533786 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.ThreePressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.ThreePressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5d833127727b79d4dbc607a5a365a3f2 +guid: 733e04f2316e4fa448bbf1b605beb5e6 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.ThreeTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.ThreeTouchProfile.asset.meta index b311c76..c639776 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.ThreeTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Button.ThreeTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1128cf02f922803459c393066239a212 +guid: 25da088bf8992fd44854880191082b59 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/SpatialPointerProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/SpatialPointerProfile.asset.meta index 5fe51dd..e61ec79 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/SpatialPointerProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/SpatialPointerProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 30554a684776dc64d832efa06d8879e6 +guid: d3c46e95cd50b9347b3ae2b984258b3c NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Touch.PrimaryThumbRestNearTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Touch.PrimaryThumbRestNearTouchProfile.asset.meta index 77bad1a..e11bb02 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Touch.PrimaryThumbRestNearTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Touch.PrimaryThumbRestNearTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e9709613c576c064dabe0b6962a09252 +guid: 4c2c7b74b24b9d946af40c80ee0d0e9a NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Touch.PrimaryThumbRestTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Touch.PrimaryThumbRestTouchProfile.asset.meta index db8379b..6f71aee 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Touch.PrimaryThumbRestTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Left/Touch.PrimaryThumbRestTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9fa15f0e93480ee45b868c815ae0a531 +guid: a28ef8a54b31cd7429a330d53d37bda4 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right.meta index 5593555..70e971d 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: dfdd9c1df9ffaae4e9c819543870a8c4 +guid: 0186bc4dba0b0d64987fb69d71c796bd folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryHandTriggerPressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryHandTriggerPressProfile.asset.meta index 438e976..d9973cf 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryHandTriggerPressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryHandTriggerPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4c67768e5e360dc4abbbba8e0145cdf1 +guid: 393406af530d2214d9aa1993942f5ff7 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryHandTriggerProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryHandTriggerProfile.asset.meta index 93ddc99..3898fb3 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryHandTriggerProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryHandTriggerProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c4fd1955456798541b4464d923b5b7e5 +guid: df4722feeca5a33488b7c7a6addddee5 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerNearTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerNearTouchProfile.asset.meta index 61d6341..62a7bc2 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerNearTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerNearTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 154f225352d33ad4badc96d265a10380 +guid: 8e023d2fa54b8d348b7457ba537d8332 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerPressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerPressProfile.asset.meta index 557129f..9a39998 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerPressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5eb2d7a4736229049bdeee1927419c0d +guid: cba7d50e18cd90041adb4ce347621080 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerProfile.asset.meta index 118524b..bba86ca 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0d499af05ab248c4fa0b76ca57527b2a +guid: ae7b13680e4179749a28db707c1b0380 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerTouchProfile.asset.meta index bd152b1..96d4f73 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis1D.SecondaryIndexTriggerTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8ebab325de63c1440bbcd61f35ebd278 +guid: 4bcb3661197898d4292c18b99b333014 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis2D.SecondaryThumbRestProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis2D.SecondaryThumbRestProfile.asset.meta index 7af105a..99e19b0 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis2D.SecondaryThumbRestProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis2D.SecondaryThumbRestProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 87792809226055e40a2b904857601712 +guid: dd3b05d4a1ecb1a4fb8223e48a0e2cd5 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis2D.SecondaryThumbstickProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis2D.SecondaryThumbstickProfile.asset.meta index d0dceea..1427878 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis2D.SecondaryThumbstickProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Axis2D.SecondaryThumbstickProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 59c9da44d8d7ab54a83b905d5f4265e3 +guid: fae8482b0216de4469c1c7ebf0b3049e NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.OnePressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.OnePressProfile.asset.meta index d809233..5c440b0 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.OnePressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.OnePressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 888aed8e55b3f584188319372e7a8a55 +guid: 5f0ef58103b43f84cbbf4fc0aa96bde9 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.OneTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.OneTouchProfile.asset.meta index ad6f96f..6bf058e 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.OneTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.OneTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6f83c259404c1be489a7c9077ebb0b28 +guid: 9b0fbb1f88de9574b8b89e38f3678182 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickNearTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickNearTouchProfile.asset.meta index 5d952b4..412c0ab 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickNearTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickNearTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1c3202d2b268f8149899c7e1487b656b +guid: 3b6894b2217fe5846aa9a0e83bafb08b NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickPressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickPressProfile.asset.meta index 7a9318e..46baa44 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickPressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e7124493dc782cf4889645f9ec2c01bf +guid: aceecb4f01c85ae46bc76cb3dd39ebca NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickTouchProfile.asset.meta index b7b5c61..25e3649 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.SecondaryThumbstickTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 583a2a4a4d22a63478d0ada16f510874 +guid: 425e5d256fb0f5d4bbd7853c139a36c6 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.TwoPressProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.TwoPressProfile.asset.meta index 421e299..28ef908 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.TwoPressProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.TwoPressProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 505faf22e96b9404d837af78c42932b2 +guid: 75c8347d2665a56419afdfb036c06a63 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.TwoTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.TwoTouchProfile.asset.meta index fdd3544..9337a4b 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.TwoTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Button.TwoTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5e8424acaef6b4f4f8d91b6e39808752 +guid: 771a9bda940dc984c80cbd0246277368 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/SpatialPointerProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/SpatialPointerProfile.asset.meta index dd9b945..a26d50e 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/SpatialPointerProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/SpatialPointerProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b3dda0b9a337a1b4f8b49b4abe228acb +guid: f647a94a748f32743840d17a974be2ef NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Touch.SecondaryThumbRestNearTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Touch.SecondaryThumbRestNearTouchProfile.asset.meta index ef311dd..86f5117 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Touch.SecondaryThumbRestNearTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Touch.SecondaryThumbRestNearTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 44d64e0bc9d128f42b8f4718a6a2484b +guid: a29c31e27b6a4dd478d0baffe9c452bf NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Touch.SecondaryThumbRestTouchProfile.asset.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Touch.SecondaryThumbRestTouchProfile.asset.meta index c3bfd48..4f04cb4 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Touch.SecondaryThumbRestTouchProfile.asset.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/Controllers/OculusTouchController/Right/Touch.SecondaryThumbRestTouchProfile.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 881b2d5a2173e8c4e9921ed1e726b45c +guid: 8d874651626c3ec468f4807dc53538b0 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/OculusPlatformServiceConfigurationsProfile.asset b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/OculusPlatformServiceConfigurationsProfile.asset index 3b2f0e7..ca5a8c0 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/OculusPlatformServiceConfigurationsProfile.asset +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Profiles~/OculusPlatformServiceConfigurationsProfile.asset @@ -25,6 +25,8 @@ MonoBehaviour: runtimePlatforms: - reference: c838c4f5-a87e-48c7-8742-09a4d85fc3bc - reference: db1acc26-ec8d-4bc6-afca-c51351b2da2e + - reference: c838c4f5-a87e-48c7-8742-09a4d85fc3bc + - reference: db1acc26-ec8d-4bc6-afca-c51351b2da2e profile: {fileID: 0} - instancedType: reference: 0de5da40-feb8-4891-b9b2-942eafd041b9 @@ -34,6 +36,8 @@ MonoBehaviour: runtimePlatforms: - reference: c838c4f5-a87e-48c7-8742-09a4d85fc3bc - reference: db1acc26-ec8d-4bc6-afca-c51351b2da2e + - reference: c838c4f5-a87e-48c7-8742-09a4d85fc3bc + - reference: db1acc26-ec8d-4bc6-afca-c51351b2da2e profile: {fileID: 11400000, guid: b849f3a28dc36b84a92d2ec4d8239cd6, type: 2} - instancedType: reference: ea666456-baef-4412-a829-a4c7132e98c3 @@ -43,4 +47,6 @@ MonoBehaviour: runtimePlatforms: - reference: c838c4f5-a87e-48c7-8742-09a4d85fc3bc - reference: db1acc26-ec8d-4bc6-afca-c51351b2da2e + - reference: c838c4f5-a87e-48c7-8742-09a4d85fc3bc + - reference: db1acc26-ec8d-4bc6-afca-c51351b2da2e profile: {fileID: 11400000, guid: d9b3b9f611dffee4883c089dc35e0ce7, type: 2} diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Plugins.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Plugins.meta index bb32e66..e500696 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Plugins.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Plugins.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: dc3b84bd4ab074f4d9f6b938e418b794 +guid: 189d6c6741b451e40b5708ac6ae12fa3 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Profiles.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Profiles.meta index 02b9107..bedfb3f 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Profiles.meta +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Profiles.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 63cd1f630a3d28f4a95eb15df714bd49 +guid: 752641a1dfaf7374db19043f00a59ff3 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Providers/Controllers/OculusHandControllerDataProvider.cs b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Providers/Controllers/OculusHandControllerDataProvider.cs index ce48917..6d0851b 100644 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Providers/Controllers/OculusHandControllerDataProvider.cs +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Providers/Controllers/OculusHandControllerDataProvider.cs @@ -5,11 +5,13 @@ using System.Collections.Generic; using UnityEngine; using XRTK.Attributes; +using XRTK.Definitions.Controllers.Hands; using XRTK.Definitions.Devices; using XRTK.Definitions.Utilities; using XRTK.Interfaces.InputSystem; using XRTK.Oculus.Plugins; using XRTK.Oculus.Profiles; +using XRTK.Oculus.Utilities; using XRTK.Providers.Controllers.Hands; using XRTK.Services; @@ -24,57 +26,44 @@ public OculusHandControllerDataProvider(string name, uint priority, OculusHandCo : base(name, priority, profile, parentService) { MinConfidenceRequired = (OculusApi.TrackingConfidence)profile.MinConfidenceRequired; + handDataProvider = new OculusHandDataConverter(); + + postProcessor = new HandDataPostProcessor(TrackedPoses) + { + PlatformProvidesPointerPose = true + }; } - private readonly OculusHandDataConverter leftHandConverter = new OculusHandDataConverter(Handedness.Left); - private readonly OculusHandDataConverter rightHandConverter = new OculusHandDataConverter(Handedness.Right); + private readonly OculusHandDataConverter handDataProvider; + private readonly HandDataPostProcessor postProcessor; private readonly Dictionary activeControllers = new Dictionary(); - private OculusApi.HandState leftHandState = default; - private OculusApi.HandState rightHandState = default; - /// /// The minimum required tracking confidence for hands to be registered. /// - public OculusApi.TrackingConfidence MinConfidenceRequired { get; } - - /// - public override void Enable() - { - base.Enable(); - - OculusHandDataConverter.HandMeshingEnabled = HandMeshingEnabled; - } + public OculusApi.TrackingConfidence MinConfidenceRequired { get; set; } /// public override void Update() { base.Update(); - var step = OculusApi.Step.Render; - - bool isLeftHandTracked = OculusApi.GetHandState(step, OculusApi.Hand.HandLeft, ref leftHandState) && - leftHandState.HandConfidence >= MinConfidenceRequired && - (leftHandState.Status & OculusApi.HandStatus.HandTracked) != 0; - - if (isLeftHandTracked) + if (handDataProvider.TryGetHandData(Handedness.Left, RenderingMode == HandRenderingMode.Mesh, MinConfidenceRequired, out var leftHandData)) { var controller = GetOrAddController(Handedness.Left); - controller?.UpdateController(leftHandConverter.GetHandData()); + leftHandData = postProcessor.PostProcess(Handedness.Left, leftHandData); + controller?.UpdateController(leftHandData); } else { RemoveController(Handedness.Left); } - bool isRightHandTracked = OculusApi.GetHandState(step, OculusApi.Hand.HandRight, ref rightHandState) && - rightHandState.HandConfidence >= MinConfidenceRequired && - (rightHandState.Status & OculusApi.HandStatus.HandTracked) != 0; - - if (isRightHandTracked) + if (handDataProvider.TryGetHandData(Handedness.Right, RenderingMode == HandRenderingMode.Mesh, MinConfidenceRequired, out var rightHandData)) { var controller = GetOrAddController(Handedness.Right); - controller?.UpdateController(rightHandConverter.GetHandData()); + rightHandData = postProcessor.PostProcess(Handedness.Right, rightHandData); + controller?.UpdateController(rightHandData); } else { diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Providers/Controllers/OculusHandDataConverter.cs b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Providers/Controllers/OculusHandDataConverter.cs deleted file mode 100644 index ecb5b1c..0000000 --- a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Providers/Controllers/OculusHandDataConverter.cs +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright (c) XRTK. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using System.Collections.Generic; -using UnityEngine; -using XRTK.Definitions.Controllers.Hands; -using XRTK.Definitions.Utilities; -using XRTK.Oculus.Extensions; -using XRTK.Oculus.Plugins; - -namespace XRTK.Oculus.Providers.Controllers -{ - /// - /// Converts oculus hand data to . - /// - public sealed class OculusHandDataConverter - { - /// - /// Constructor. - /// - /// Handedness of the hand this converter is created for. - public OculusHandDataConverter(Handedness handedness) - { - this.handedness = handedness; - } - - private readonly Dictionary boneProxyTransforms = new Dictionary(); - private readonly Handedness handedness; - - private bool isInitialized = false; - private OculusApi.Skeleton handSkeleton = new OculusApi.Skeleton(); - private OculusApi.HandState handState = new OculusApi.HandState(); - private OculusApi.Mesh handMesh = new OculusApi.Mesh(); - - /// - /// Gets or sets whether hand mesh data should be read and converted. - /// - public static bool HandMeshingEnabled { get; set; } - - /// - /// Reads hand data for the current frame and converts it to agnostic hand data. - /// - /// Updated hand data. - public HandData GetHandData() - { - if (!isInitialized) - { - isInitialized = OculusApi.GetSkeleton(handedness.ToSkeletonType(), out handSkeleton); - if (!isInitialized) - { - Debug.LogError($"{GetType().Name} - {handedness} failed to initialize."); - return null; - } - } - - HandData updatedHandData = new HandData - { - IsTracked = OculusApi.GetHandState(OculusApi.Step.Render, handedness.ToHand(), ref handState), - TimeStamp = DateTimeOffset.UtcNow.Ticks - }; - - if (updatedHandData.IsTracked) - { - UpdateHandJoints(updatedHandData.Joints); - - if (HandMeshingEnabled && TryGetUpdatedHandMeshData(out HandMeshData data)) - { - updatedHandData.Mesh = data; - } - else - { - updatedHandData.Mesh = new HandMeshData(); - } - } - - return updatedHandData; - } - - private void UpdateHandJoints(MixedRealityPose[] jointPoses) - { - for (int i = 0; i < jointPoses.Length; i++) - { - TrackedHandJoint trackedHandJoint = (TrackedHandJoint)i; - switch (trackedHandJoint) - { - // Wrist and Palm - case TrackedHandJoint.Wrist: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_WristRoot]); - break; - case TrackedHandJoint.Palm: - jointPoses[i] = EstimatePalmPose(); - break; - // Finger: Thumb - case TrackedHandJoint.ThumbMetacarpalJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb1]); - break; - case TrackedHandJoint.ThumbProximalJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb2]); - break; - case TrackedHandJoint.ThumbDistalJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb3]); - break; - case TrackedHandJoint.ThumbTip: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_ThumbTip]); - break; - // Finger: Index - case TrackedHandJoint.IndexMetacarpal: - jointPoses[i] = EstimateIndexMetacarpal(); - break; - case TrackedHandJoint.IndexKnuckle: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Index1]); - break; - case TrackedHandJoint.IndexMiddleJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Index2]); - break; - case TrackedHandJoint.IndexDistalJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Index3]); - break; - case TrackedHandJoint.IndexTip: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_IndexTip]); - break; - // Finger: Middle - case TrackedHandJoint.MiddleMetacarpal: - jointPoses[i] = EstimateMiddleMetacarpal(); - break; - case TrackedHandJoint.MiddleKnuckle: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Middle1]); - break; - case TrackedHandJoint.MiddleMiddleJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Middle2]); - break; - case TrackedHandJoint.MiddleDistalJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Middle3]); - break; - case TrackedHandJoint.MiddleTip: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_MiddleTip]); - break; - // Finger: Ring - case TrackedHandJoint.RingMetacarpal: - jointPoses[i] = EstimateRingMetacarpal(); - break; - case TrackedHandJoint.RingKnuckle: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Ring1]); - break; - case TrackedHandJoint.RingMiddleJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Ring2]); - break; - case TrackedHandJoint.RingDistalJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Ring3]); - break; - case TrackedHandJoint.RingTip: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_RingTip]); - break; - // Finger: Pinky - case TrackedHandJoint.PinkyMetacarpal: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky0]); - break; - case TrackedHandJoint.PinkyKnuckle: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky1]); - break; - case TrackedHandJoint.PinkyMiddleJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky2]); - break; - case TrackedHandJoint.PinkyDistalJoint: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky3]); - break; - case TrackedHandJoint.PinkyTip: - jointPoses[i] = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_PinkyTip]); - break; - } - } - } - - private bool TryGetUpdatedHandMeshData(out HandMeshData data) - { - if (OculusApi.GetMesh(handedness.ToMeshType(), out handMesh)) - { - Vector3[] vertices = new Vector3[handMesh.NumVertices]; - - for (int i = 0; i < handMesh.NumVertices; ++i) - { - vertices[i] = handMesh.VertexPositions[i].FromFlippedZVector3f(); - } - - Vector2[] uvs = new Vector2[handMesh.NumVertices]; - - for (int i = 0; i < handMesh.NumVertices; ++i) - { - uvs[i] = new Vector2(handMesh.VertexUV0[i].x, -handMesh.VertexUV0[i].y); - } - - int[] triangles = new int[handMesh.NumIndices]; - - for (int i = 0; i < handMesh.NumIndices; ++i) - { - triangles[i] = handMesh.Indices[handMesh.NumIndices - i - 1]; - } - - Vector3[] normals = new Vector3[handMesh.NumVertices]; - - for (int i = 0; i < handMesh.NumVertices; ++i) - { - normals[i] = handMesh.VertexNormals[i].FromFlippedZVector3f(); - } - - data = new HandMeshData(vertices, triangles, normals, uvs, handState.RootPose.Position.FromFlippedZVector3f(), handState.RootPose.Orientation.FromFlippedZQuatf()); - - return true; - } - - data = default; - return false; - } - - private MixedRealityPose EstimateIndexMetacarpal() - { - MixedRealityPose thumbMetacarpalPose = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb1]); - MixedRealityPose pinkyMetacarpalPose = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky0]); - Vector3 indexMetacarpalPosition = Vector3.Lerp(thumbMetacarpalPose.Position, pinkyMetacarpalPose.Position, .2f); - Quaternion indexMetacarpalRotation = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_WristRoot]).Rotation; - - return new MixedRealityPose(indexMetacarpalPosition, indexMetacarpalRotation); - } - - private MixedRealityPose EstimateRingMetacarpal() - { - MixedRealityPose thumbMetacarpalPose = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb1]); - MixedRealityPose pinkyMetacarpalPose = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky0]); - Vector3 ringMetacarpalPosition = Vector3.Lerp(thumbMetacarpalPose.Position, pinkyMetacarpalPose.Position, .8f); - Quaternion ringMetacarpalRotation = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_WristRoot]).Rotation; - - return new MixedRealityPose(ringMetacarpalPosition, ringMetacarpalRotation); - } - - private MixedRealityPose EstimateMiddleMetacarpal() - { - MixedRealityPose thumbMetacarpalPose = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb1]); - MixedRealityPose pinkyMetacarpalPose = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky0]); - Vector3 middleMetacarpalPosition = Vector3.Lerp(thumbMetacarpalPose.Position, pinkyMetacarpalPose.Position, .5f); - Quaternion middleMetacarpalRotation = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_WristRoot]).Rotation; - - return new MixedRealityPose(middleMetacarpalPosition, middleMetacarpalRotation); - } - - private MixedRealityPose EstimatePalmPose() - { - MixedRealityPose middleMetacarpalPose = EstimateMiddleMetacarpal(); - MixedRealityPose middleKnucklePose = ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Middle1]); - Vector3 palmPosition = Vector3.Lerp(middleMetacarpalPose.Position, middleKnucklePose.Position, .5f); - Quaternion palmRotation = middleMetacarpalPose.Rotation; - - return new MixedRealityPose(palmPosition, palmRotation); - } - - private MixedRealityPose ComputeJointPose(OculusApi.Bone bone) - { - // HACK: The Pinky and Thumb 1+ bones depend on the Pinky/Thumb 0 bone - // to be availble, which the XRTK hand tracking does not use. We still gotta update them to - // be able to resolve pose dependencies. - if (bone.Id == OculusApi.BoneId.Hand_Thumb1) - { - ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb0]); - } - - if (bone.Id == OculusApi.BoneId.Hand_Pinky1) - { - ComputeJointPose(handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky0]); - } - - Transform proxyTransform = GetProxyTransform(bone.Id); - Transform parentProxyTransform = GetProxyTransform((OculusApi.BoneId)bone.ParentBoneIndex); - - if (parentProxyTransform == null) - { - Vector3 rootPosition = handState.RootPose.Position.FromFlippedZVector3f(); - rootPosition.y += OculusApi.EyeHeight; - proxyTransform.position = rootPosition; - proxyTransform.rotation = handState.RootPose.Orientation.FromFlippedZQuatf(); - } - else - { - proxyTransform.parent = parentProxyTransform; - proxyTransform.localPosition = bone.Pose.Position.FromFlippedZVector3f(); - proxyTransform.localRotation = handState.BoneRotations[(int)bone.Id].FromFlippedZQuatf(); - } - - // Compute final bone pose. - return FixRotation(new MixedRealityPose(proxyTransform.position, proxyTransform.rotation)); - } - - private MixedRealityPose FixRotation(MixedRealityPose bonePose) - { - // WARNING THIS CODE IS SUBJECT TO CHANGE WITH THE OCULUS SDK - // - This fix is a hack to fix broken and inconsistent rotations for hands. - if (handedness == Handedness.Left) - { - // Rotate bone 180 degrees on X to flip up. - bonePose.Rotation *= Quaternion.Euler(180f, 0f, 0f); - - // Rotate bone 90 degrees on Y to align X with right. - bonePose.Rotation *= Quaternion.Euler(0f, 90f, 0f); - } - else - { - // Rotate bone 90 degrees on Y to align X with left. - bonePose.Rotation *= Quaternion.Euler(0f, -90f, 0f); - } - - return bonePose; - } - - private Transform GetProxyTransform(OculusApi.BoneId boneId) - { - if (boneId == OculusApi.BoneId.Invalid) - { - return null; - } - - if (boneProxyTransforms.ContainsKey((int)boneId)) - { - return boneProxyTransforms[(int)boneId]; - } - - var transform = new GameObject($"Oculus Hand {handedness} {boneId} Proxy").transform; - boneProxyTransforms.Add((int)boneId, transform); - - return transform; - } - } -} \ No newline at end of file diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Utilities.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Utilities.meta new file mode 100644 index 0000000..456aad9 --- /dev/null +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Utilities.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fb296407c3d810d4888613a033f7244b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Utilities/OculusHandDataConverter.cs b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Utilities/OculusHandDataConverter.cs new file mode 100644 index 0000000..9e68547 --- /dev/null +++ b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Utilities/OculusHandDataConverter.cs @@ -0,0 +1,324 @@ +// Copyright (c) XRTK. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; +using System.Collections.Generic; +using UnityEngine; +using XRTK.Definitions.Controllers.Hands; +using XRTK.Definitions.Devices; +using XRTK.Definitions.Utilities; +using XRTK.Extensions; +using XRTK.Oculus.Extensions; +using XRTK.Oculus.Plugins; +using XRTK.Services; +using XRTK.Utilities; + +namespace XRTK.Oculus.Utilities +{ + /// + /// Converts oculus hand data to . + /// + public sealed class OculusHandDataConverter + { + /// + /// Destructor. + /// + ~OculusHandDataConverter() + { + if (!conversionProxyRootTransform.IsNull()) + { + conversionProxyTransforms.Clear(); + conversionProxyRootTransform.Destroy(); + } + } + + private Transform conversionProxyRootTransform; + private readonly Dictionary conversionProxyTransforms = new Dictionary(); + private readonly MixedRealityPose[] jointPoses = new MixedRealityPose[HandData.JointCount]; + + private OculusApi.Skeleton handSkeleton = new OculusApi.Skeleton(); + private OculusApi.HandState handState = new OculusApi.HandState(); + private OculusApi.Mesh handMesh = new OculusApi.Mesh(); + + /// + /// Reads hand APIs for the current frame and converts it to agnostic . + /// + /// The handedness of the hand to get for. + /// If set, hand mesh information will be included in . + /// The minimum required to consider hands tracked. + /// The output . + /// True, if data conversion was a success. + public bool TryGetHandData(Handedness handedness, bool includeMeshData, OculusApi.TrackingConfidence minTrackingConfidence, out HandData handData) + { + // Here we check whether the hand is being tracked at all by the Oculus system. + if (!(OculusApi.GetHandState(OculusApi.Step.Render, handedness.ToHand(), ref handState) && + OculusApi.GetSkeleton(handedness.ToSkeletonType(), out handSkeleton))) + { + handData = default; + return false; + } + + // The hand is being tracked, next we verify it meets our confidence requirements to consider + // it tracked. + handData = new HandData + { + TrackingState = (handState.HandConfidence >= minTrackingConfidence && (handState.Status & OculusApi.HandStatus.HandTracked) != 0) ? TrackingState.Tracked : TrackingState.NotTracked, + UpdatedAt = DateTimeOffset.UtcNow.Ticks + }; + + // If the hand is tracked per requirements, we get updated joint data + // and other data needed for updating the hand controller's state. + if (handData.TrackingState == TrackingState.Tracked) + { + handData.RootPose = GetHandRootPose(handedness); + handData.Joints = GetJointPoses(handedness); + handData.PointerPose = GetPointerPose(handedness); + + if (includeMeshData && TryGetUpdatedHandMeshData(handedness, out HandMeshData data)) + { + handData.Mesh = data; + } + else + { + handData.Mesh = HandMeshData.Empty; + } + } + + // Even if the hand is being tracked by the system but the confidence did not + // meet our requirements, we return true. This allows the hand controller and visualizers + // to react to tracking loss and keep the hand up for a given time before destroying the controller. + return true; + } + + /// + /// Gets updated joint poses for all s. + /// + /// Handedness of the hand to read joint poses for. + /// Joint poses in order. + private MixedRealityPose[] GetJointPoses(Handedness handedness) + { + jointPoses[(int)TrackedHandJoint.Wrist] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_WristRoot]); + + jointPoses[(int)TrackedHandJoint.ThumbMetacarpal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb1]); + jointPoses[(int)TrackedHandJoint.ThumbProximal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb2]); + jointPoses[(int)TrackedHandJoint.ThumbDistal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb3]); + jointPoses[(int)TrackedHandJoint.ThumbTip] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_ThumbTip]); + + jointPoses[(int)TrackedHandJoint.IndexProximal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Index1]); + jointPoses[(int)TrackedHandJoint.IndexIntermediate] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Index2]); + jointPoses[(int)TrackedHandJoint.IndexDistal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Index3]); + jointPoses[(int)TrackedHandJoint.IndexTip] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_IndexTip]); + + jointPoses[(int)TrackedHandJoint.MiddleProximal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Middle1]); + jointPoses[(int)TrackedHandJoint.MiddleIntermediate] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Middle2]); + jointPoses[(int)TrackedHandJoint.MiddleDistal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Middle3]); + jointPoses[(int)TrackedHandJoint.MiddleTip] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_MiddleTip]); + + jointPoses[(int)TrackedHandJoint.RingProximal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Ring1]); + jointPoses[(int)TrackedHandJoint.RingIntermediate] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Ring2]); + jointPoses[(int)TrackedHandJoint.RingDistal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Ring3]); + jointPoses[(int)TrackedHandJoint.RingTip] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_RingTip]); + + jointPoses[(int)TrackedHandJoint.LittleMetacarpal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky0]); + jointPoses[(int)TrackedHandJoint.LittleProximal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky1]); + jointPoses[(int)TrackedHandJoint.LittleIntermediate] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky2]); + jointPoses[(int)TrackedHandJoint.LittleDistal] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky3]); + jointPoses[(int)TrackedHandJoint.LittleTip] = GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_PinkyTip]); + + // Estimated: These joint poses are not provided by the Oculus + // hand tracking implementation. But with the data we now have, we can + // estimate their poses fairly well. + jointPoses[(int)TrackedHandJoint.Palm] = HandUtilities.GetEstimatedPalmPose(jointPoses); + jointPoses[(int)TrackedHandJoint.IndexMetacarpal] = HandUtilities.GetEstimatedIndexMetacarpalPose(jointPoses); + jointPoses[(int)TrackedHandJoint.MiddleMetacarpal] = HandUtilities.GetEstimatedMiddleMetacarpalPose(jointPoses); + jointPoses[(int)TrackedHandJoint.RingMetacarpal] = HandUtilities.GetEstimatedRingMetacarpalPose(jointPoses); + + return jointPoses; + } + + /// + /// Attempts to get updated hand mesh data. + /// + /// The handedness of the hand to get mesh data for. + /// Mesh information retrieved in case of success. + /// True, if mesh data could be loaded. + private bool TryGetUpdatedHandMeshData(Handedness handedness, out HandMeshData data) + { + if (OculusApi.GetMesh(handedness.ToMeshType(), out handMesh)) + { + Vector3[] vertices = new Vector3[handMesh.NumVertices]; + + for (int i = 0; i < handMesh.NumVertices; ++i) + { + vertices[i] = handMesh.VertexPositions[i].FromFlippedZVector3f(); + } + + Vector2[] uvs = new Vector2[handMesh.NumVertices]; + + for (int i = 0; i < handMesh.NumVertices; ++i) + { + uvs[i] = new Vector2(handMesh.VertexUV0[i].x, -handMesh.VertexUV0[i].y); + } + + int[] triangles = new int[handMesh.NumIndices]; + + for (int i = 0; i < handMesh.NumIndices; ++i) + { + triangles[i] = handMesh.Indices[handMesh.NumIndices - i - 1]; + } + + Vector3[] normals = new Vector3[handMesh.NumVertices]; + + for (int i = 0; i < handMesh.NumVertices; ++i) + { + normals[i] = handMesh.VertexNormals[i].FromFlippedZVector3f(); + } + + data = new HandMeshData(vertices, triangles, normals, uvs); + + return true; + } + + data = default; + return false; + } + + /// + /// Gets a single joint's pose relative to the hand root pose. + /// + /// Handedness of the hand the pose belongs to. + /// Bone data retrieved from Oculus API with pose information. + /// Converted joint pose in hand space. + private MixedRealityPose GetJointPose(Handedness handedness, OculusApi.Bone bone) + { + // The Pinky/Thumb 1+ bones depend on the Pinky/Thumb 0 bone + // to be available, which the XRTK hand tracking does not use. We still have to compute them to + // be able to resolve pose relation dependencies. + if (bone.Id == OculusApi.BoneId.Hand_Thumb1) + { + GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Thumb0]); + } + else if (bone.Id == OculusApi.BoneId.Hand_Pinky1) + { + GetJointPose(handedness, handSkeleton.Bones[(int)OculusApi.BoneId.Hand_Pinky0]); + } + + var boneProxyTransform = GetProxyTransform(handedness, bone.Id); + var parentProxyTransform = GetProxyTransform(handedness, (OculusApi.BoneId)bone.ParentBoneIndex); + + boneProxyTransform.parent = parentProxyTransform; + + if (bone.ParentBoneIndex == (int)OculusApi.BoneId.Invalid) + { + var rootPose = FixRotation(handedness, new MixedRealityPose(conversionProxyRootTransform.localPosition, conversionProxyRootTransform.localRotation)); + boneProxyTransform.localPosition = rootPose.Position; + boneProxyTransform.localRotation = rootPose.Rotation; + } + else + { + boneProxyTransform.localPosition = bone.Pose.Position.FromFlippedZVector3f(); + boneProxyTransform.localRotation = handState.BoneRotations[(int)bone.Id].FromFlippedZQuatf(); + } + + return FixRotation(handedness, new MixedRealityPose( + conversionProxyRootTransform.InverseTransformPoint(boneProxyTransform.position), + Quaternion.Inverse(conversionProxyRootTransform.rotation) * boneProxyTransform.rotation)); + } + + /// + /// WARNING: THIS CODE IS SUBJECT TO CHANGE WITH THE OCULUS SDK. + /// This fix is a hack to fix broken and inconsistent rotations for hands. + /// + /// Handedness of the hand the pose belongs to. + /// The joint pose to apply the fix to. + /// Joint pose with fixed rotation. + private MixedRealityPose FixRotation(Handedness handedness, MixedRealityPose jointPose) + { + if (handedness == Handedness.Left) + { + // Rotate bone 180 degrees on X to flip up. + jointPose.Rotation *= Quaternion.Euler(180f, 0f, 0f); + + // Rotate bone 90 degrees on Y to align X with right. + jointPose.Rotation *= Quaternion.Euler(0f, 90f, 0f); + } + else + { + // Rotate bone 90 degrees on Y to align X with left. + jointPose.Rotation *= Quaternion.Euler(0f, -90f, 0f); + } + + return jointPose; + } + + /// + /// The oculus APIs return joint poses relative to their parent joint unlike + /// other platforms where joint poses are relative to the hand root. To convert + /// the joint-->parent-joint relation to joint-->hand-root relations proxy s + /// are used. The proxies are parented to their respective parent . + /// That way we can make use of Unity APIs to translate coordinate spaces. + /// + /// Handedness of the hand the proxy belongs to. + /// The Oculus bone ID to lookup the proxy for. + /// The proxy . + private Transform GetProxyTransform(Handedness handedness, OculusApi.BoneId boneId) + { + if (conversionProxyRootTransform.IsNull()) + { + conversionProxyRootTransform = new GameObject("Oculus Hand Conversion Proxy").transform; + conversionProxyRootTransform.transform.SetParent(MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform, false); + conversionProxyRootTransform.gameObject.SetActive(false); + } + + // Depending on the handedness we are currently working on, we need to + // rotate the conversion root. Same dilemma as with FixRotation above. + conversionProxyRootTransform.localRotation = Quaternion.Euler(0f, handedness == Handedness.Right ? 180f : 0f, 0f); + + if (boneId == OculusApi.BoneId.Invalid) + { + return conversionProxyRootTransform; + } + + if (conversionProxyTransforms.ContainsKey(boneId)) + { + return conversionProxyTransforms[boneId]; + } + + var transform = new GameObject($"Oculus Hand {boneId} Proxy").transform; + conversionProxyTransforms.Add(boneId, transform); + + return transform; + } + + /// + /// Gets the hand's root pose. + /// + /// Handedness of the hand to get the pose for. + /// The hands value. + private MixedRealityPose GetHandRootPose(Handedness handedness) + { + var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; + var rootPosition = playspaceTransform.InverseTransformPoint(playspaceTransform.position + playspaceTransform.rotation * handState.RootPose.Position.FromFlippedZVector3f()); + var rootRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * handState.RootPose.Orientation.FromFlippedZQuatf(); + + return FixRotation(handedness, new MixedRealityPose(rootPosition + new Vector3(0f, OculusApi.EyeHeight, 0f), rootRotation)); + } + + /// + /// Gets the hand's local pointer pose. + /// + /// Handedness of the hand the pose belongs to. + /// The hands value. + private MixedRealityPose GetPointerPose(Handedness handedness) + { + var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform; + var rootPose = GetHandRootPose(handedness); + var platformRootPosition = handState.RootPose.Position.FromFlippedZVector3f(); + + var platformPointerPosition = rootPose.Position + handState.PointerPose.Position.FromFlippedZVector3f() - platformRootPosition; + var platformPointerRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * handState.PointerPose.Orientation.FromFlippedZQuatf(); + + return new MixedRealityPose(platformPointerPosition, platformPointerRotation); + } + } +} \ No newline at end of file diff --git a/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Providers/Controllers/OculusHandDataConverter.cs.meta b/XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Utilities/OculusHandDataConverter.cs.meta similarity index 100% rename from XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Providers/Controllers/OculusHandDataConverter.cs.meta rename to XRTK.Oculus/Packages/com.xrtk.oculus/Runtime/Utilities/OculusHandDataConverter.cs.meta