@@ -231,19 +231,34 @@ private void UpdatePinchSelection()
231231 {
232232 using ( UpdatePinchSelectionPerfMarker . Auto ( ) )
233233 {
234- float pinchAmount ;
234+ bool hasPinchData = false ;
235+ float pinchAmount = 0 ;
236+ float pinchProgress = 0 ;
235237
236- // This section accounts for "select value" being bound while "select" is polyfilled.
237- // We can use the data from the bound action to synthesize better than the hand joint logic will.
238- if ( ! m_isSelectValuePolyfilled && ! m_isTrackingStatePolyfilled )
239- {
240- pinchAmount = ReadValue ( ) ;
241- }
242238 // Workaround for missing select actions on devices without interaction profiles
243239 // for hands, such as Varjo and Quest. Should be removed once we have universal
244240 // hand interaction profile(s) across vendors.
245- else if ( XRSubsystemHelpers . HandsAggregator == null
246- || ! XRSubsystemHelpers . HandsAggregator . TryGetPinchProgress ( handNode , out _ , out _ , out pinchAmount ) )
241+ if ( XRSubsystemHelpers . HandsAggregator != null
242+ && XRSubsystemHelpers . HandsAggregator . TryGetPinchProgress ( handNode , out _ , out _ , out pinchProgress ) )
243+ {
244+ hasPinchData |= true ;
245+ }
246+
247+ // This section accounts for one of "select" and "select value" being bound while the other is polyfilled.
248+ // We can use the data from the bound action to synthesize the other better than the hand joint logic will.
249+ if ( ! m_isSelectPolyfilled && ! m_isTrackingStatePolyfilled )
250+ {
251+ // If we successfully read hand joint data, we should use that instead of clamping to 0 or 1
252+ pinchAmount = pinchProgress > 0 ? pinchProgress : ReadIsPerformed ( ) ? 1 : 0 ;
253+ hasPinchData |= true ;
254+ }
255+ else if ( ! m_isSelectValuePolyfilled && ! m_isTrackingStatePolyfilled )
256+ {
257+ pinchAmount = ReadValue ( ) ;
258+ hasPinchData |= true ;
259+ }
260+
261+ if ( ! hasPinchData )
247262 {
248263 // If we didn't get pinch data, reset the fallback state.
249264 m_fallbackState = default ;
0 commit comments