@@ -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,10 +75,16 @@ protected override void OnUpdateDeviceConnectionAndPoses()
7475 trackingActivator . TryFetchData ( WVR_PoseOriginModel . WVR_PoseOriginModel_OriginOnHead ) ;
7576 }
7677
78+ gestureActivator . TryFetchData ( ) ;
79+
80+ var isFocused = Interop . WVR_IsInputFocusCapturedBySystem ( ) ;
81+ var isLeftValid = ! isFocused && ( trackingActivator . isLeftValid || gestureActivator . isLeftValid ) ;
82+ var isRightValid = ! isFocused && ( trackingActivator . isRightValid || gestureActivator . isRightValid ) ;
83+
7784 IVRModuleDeviceState prevState ;
7885 IVRModuleDeviceStateRW currState ;
7986 // update connection/pose for left hand devices
80- if ( trackingActivator . isLeftValid )
87+ if ( isLeftValid )
8188 {
8289 if ( leftDeviceIndex != VRModule . INVALID_DEVICE_INDEX )
8390 {
@@ -97,7 +104,10 @@ protected override void OnUpdateDeviceConnectionAndPoses()
97104 }
98105
99106 currState . isConnected = true ;
107+
100108 trackingActivator . UpdateJoints ( currState , true ) ;
109+ trackingActivator . UpdateDeviceInput ( currState , true ) ;
110+ gestureActivator . UpdateDeviceInput ( currState , true ) ;
101111 }
102112 else
103113 {
@@ -109,7 +119,7 @@ protected override void OnUpdateDeviceConnectionAndPoses()
109119 }
110120 }
111121
112- if ( trackingActivator . isRightValid )
122+ if ( isRightValid )
113123 {
114124 if ( rightDeviceIndex != VRModule . INVALID_DEVICE_INDEX )
115125 {
@@ -129,7 +139,10 @@ protected override void OnUpdateDeviceConnectionAndPoses()
129139 }
130140
131141 currState . isConnected = true ;
142+
132143 trackingActivator . UpdateJoints ( currState , false ) ;
144+ trackingActivator . UpdateDeviceInput ( currState , false ) ;
145+ gestureActivator . UpdateDeviceInput ( currState , false ) ;
133146 }
134147 else
135148 {
@@ -142,46 +155,6 @@ protected override void OnUpdateDeviceConnectionAndPoses()
142155 }
143156 }
144157
145- protected override void OnUpdateDeviceInput ( )
146- {
147- gestureActivator . SetActive ( VRModuleSettings . enableWaveHandGesture && deviceFeature . supportGesture ) ;
148-
149- gestureActivator . TryFetchData ( ) ;
150-
151- IVRModuleDeviceState prevState ;
152- IVRModuleDeviceStateRW currState ;
153-
154- if ( leftDeviceIndex != VRModule . INVALID_DEVICE_INDEX )
155- {
156- if ( gestureActivator . isLeftValid )
157- {
158- EnsureValidDeviceState ( leftDeviceIndex , out prevState , out currState ) ;
159- gestureActivator . UpdateGestureInput ( currState , true ) ;
160- }
161-
162- if ( trackingActivator . isLeftValid )
163- {
164- EnsureValidDeviceState ( leftDeviceIndex , out prevState , out currState ) ;
165- trackingActivator . UpdateDeviceInput ( currState , true ) ;
166- }
167- }
168-
169- if ( rightDeviceIndex != VRModule . INVALID_DEVICE_INDEX )
170- {
171- if ( gestureActivator . isRightValid )
172- {
173- EnsureValidDeviceState ( rightDeviceIndex , out prevState , out currState ) ;
174- gestureActivator . UpdateGestureInput ( currState , false ) ;
175- }
176-
177- if ( trackingActivator . isRightValid )
178- {
179- EnsureValidDeviceState ( rightDeviceIndex , out prevState , out currState ) ;
180- trackingActivator . UpdateDeviceInput ( currState , false ) ;
181- }
182- }
183- }
184-
185158 public override uint GetLeftHandedIndex ( ) { return leftDeviceIndex ; }
186159
187160 public override uint GetRightHandedIndex ( ) { return rightDeviceIndex ; }
@@ -492,9 +465,9 @@ public bool TryFetchData(WVR_PoseOriginModel originModel)
492465 return false ;
493466 }
494467
495- public bool isLeftValid { get { return trackingData . left . isValidPose && ! Interop . WVR_IsInputFocusCapturedBySystem ( ) ; } }
468+ public bool isLeftValid { get { return trackingData . left . isValidPose ; } }
496469
497- public bool isRightValid { get { return trackingData . right . isValidPose && ! Interop . WVR_IsInputFocusCapturedBySystem ( ) ; } }
470+ public bool isRightValid { get { return trackingData . right . isValidPose ; } }
498471
499472 public WVR_HandPoseState_t getLeftPinchData { get { return pinchData . left ; } }
500473
@@ -787,20 +760,21 @@ public bool TryFetchData()
787760 return false ;
788761 }
789762
790- public void UpdateGestureInput ( IVRModuleDeviceStateRW state , bool isLeft )
763+ public void UpdateDeviceInput ( IVRModuleDeviceStateRW state , bool isLeft )
791764 {
792765 var gesture = isLeft ? gestureData . left : gestureData . right ;
766+
793767 state . SetButtonPress ( VRModuleRawButton . GestureFist , gesture == WVR_HandGestureType . WVR_HandGestureType_Fist ) ;
794- state . SetButtonPress ( VRModuleRawButton . GestureFive , gesture == WVR_HandGestureType . WVR_HandGestureType_Five ) ;
795- state . SetButtonPress ( VRModuleRawButton . GestureIndexUp , gesture == WVR_HandGestureType . WVR_HandGestureType_IndexUp ) ;
796- state . SetButtonPress ( VRModuleRawButton . GestureOk , gesture == WVR_HandGestureType . WVR_HandGestureType_OK ) ;
797- state . SetButtonPress ( VRModuleRawButton . GestureThumbUp , gesture == WVR_HandGestureType . WVR_HandGestureType_ThumbUp ) ;
798- state . SetButtonPress ( VRModuleRawButton . System , gesture == WVR_HandGestureType_WVR_HandGestureType_Palm_Pinch ) ;
799768 state . SetButtonTouch ( VRModuleRawButton . GestureFist , gesture == WVR_HandGestureType . WVR_HandGestureType_Fist ) ;
769+ state . SetButtonPress ( VRModuleRawButton . GestureFive , gesture == WVR_HandGestureType . WVR_HandGestureType_Five ) ;
800770 state . SetButtonTouch ( VRModuleRawButton . GestureFive , gesture == WVR_HandGestureType . WVR_HandGestureType_Five ) ;
771+ state . SetButtonPress ( VRModuleRawButton . GestureIndexUp , gesture == WVR_HandGestureType . WVR_HandGestureType_IndexUp ) ;
801772 state . SetButtonTouch ( VRModuleRawButton . GestureIndexUp , gesture == WVR_HandGestureType . WVR_HandGestureType_IndexUp ) ;
773+ state . SetButtonPress ( VRModuleRawButton . GestureOk , gesture == WVR_HandGestureType . WVR_HandGestureType_OK ) ;
802774 state . SetButtonTouch ( VRModuleRawButton . GestureOk , gesture == WVR_HandGestureType . WVR_HandGestureType_OK ) ;
775+ state . SetButtonPress ( VRModuleRawButton . GestureThumbUp , gesture == WVR_HandGestureType . WVR_HandGestureType_ThumbUp ) ;
803776 state . SetButtonTouch ( VRModuleRawButton . GestureThumbUp , gesture == WVR_HandGestureType . WVR_HandGestureType_ThumbUp ) ;
777+ state . SetButtonPress ( VRModuleRawButton . System , gesture == WVR_HandGestureType_WVR_HandGestureType_Palm_Pinch ) ;
804778 state . SetButtonTouch ( VRModuleRawButton . System , gesture == WVR_HandGestureType_WVR_HandGestureType_Palm_Pinch ) ;
805779 }
806780
0 commit comments