Skip to content

Commit 327c0a8

Browse files
author
lawwong
committed
Now fetch Wave hand tracking & gesture at the same time
1 parent b82d836 commit 327c0a8

1 file changed

Lines changed: 15 additions & 18 deletions

File tree

Assets/HTC.UnityPlugin/VRModule/Submodules/WaveHandTrackingSubmodule.cs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ protected override void OnDeactivated()
6464
protected override void OnUpdateDeviceConnectionAndPoses()
6565
{
6666
trackingActivator.SetActive(deviceFeature.supportTracking);
67+
gestureActivator.SetActive(VRModuleSettings.enableWaveHandGesture && deviceFeature.supportGesture);
6768

6869
if (VRModule.trackingSpaceType == VRModuleTrackingSpaceType.RoomScale)
6970
{
@@ -74,6 +75,8 @@ protected override void OnUpdateDeviceConnectionAndPoses()
7475
trackingActivator.TryFetchData(WVR_PoseOriginModel.WVR_PoseOriginModel_OriginOnHead);
7576
}
7677

78+
gestureActivator.TryFetchData();
79+
7780
var isFocused = Interop.WVR_IsInputFocusCapturedBySystem();
7881
var isLeftValid = !isFocused && (trackingActivator.isLeftValid || gestureActivator.isLeftValid);
7982
var isRightValid = !isFocused && (trackingActivator.isRightValid || gestureActivator.isRightValid);
@@ -105,6 +108,12 @@ protected override void OnUpdateDeviceConnectionAndPoses()
105108
if (trackingActivator.isLeftValid)
106109
{
107110
trackingActivator.UpdateJoints(currState, true);
111+
trackingActivator.UpdateDeviceInput(currState, true);
112+
}
113+
114+
if (gestureActivator.isLeftValid)
115+
{
116+
gestureActivator.UpdateDeviceInput(currState, true);
108117
}
109118
}
110119
else
@@ -141,6 +150,12 @@ protected override void OnUpdateDeviceConnectionAndPoses()
141150
if (trackingActivator.isRightValid)
142151
{
143152
trackingActivator.UpdateJoints(currState, false);
153+
trackingActivator.UpdateDeviceInput(currState, false);
154+
}
155+
156+
if (gestureActivator.isRightValid)
157+
{
158+
gestureActivator.UpdateDeviceInput(currState, false);
144159
}
145160
}
146161
else
@@ -154,24 +169,6 @@ protected override void OnUpdateDeviceConnectionAndPoses()
154169
}
155170
}
156171

157-
protected override void OnUpdateDeviceInput()
158-
{
159-
gestureActivator.SetActive(VRModuleSettings.enableWaveHandGesture && deviceFeature.supportGesture);
160-
161-
gestureActivator.TryFetchData();
162-
163-
IVRModuleDeviceState prevState;
164-
IVRModuleDeviceStateRW currState;
165-
166-
EnsureValidDeviceState(leftDeviceIndex, out prevState, out currState);
167-
gestureActivator.UpdateDeviceInput(currState, true);
168-
trackingActivator.UpdateDeviceInput(currState, true);
169-
170-
EnsureValidDeviceState(rightDeviceIndex, out prevState, out currState);
171-
gestureActivator.UpdateDeviceInput(currState, false);
172-
trackingActivator.UpdateDeviceInput(currState, false);
173-
}
174-
175172
public override uint GetLeftHandedIndex() { return leftDeviceIndex; }
176173

177174
public override uint GetRightHandedIndex() { return rightDeviceIndex; }

0 commit comments

Comments
 (0)