@@ -471,17 +471,19 @@ protected void UpdateCallback()
471471 // Update current input values if this is the first update since becoming enabled
472472 // since the performed callbacks may not have been executed. In case there is no bound control
473473 // we preserve current transform by extracting transform values as initial values instead.
474- if ( HasResolvedControl ( m_PositionInput . action ) )
474+ var hasResolvedPositionInputControl = HasResolvedControl ( m_PositionInput . action ) ;
475+ if ( hasResolvedPositionInputControl )
475476 m_CurrentPosition = m_PositionInput . action . ReadValue < Vector3 > ( ) ;
476477 else
477478 m_CurrentPosition = transform . localPosition ;
478479
479- if ( HasResolvedControl ( m_RotationInput . action ) )
480+ var hasResolvedRotationInputControl = HasResolvedControl ( m_RotationInput . action ) ;
481+ if ( hasResolvedRotationInputControl )
480482 m_CurrentRotation = m_RotationInput . action . ReadValue < Quaternion > ( ) ;
481483 else
482484 m_CurrentRotation = transform . localRotation ;
483485
484- ReadTrackingState ( ) ;
486+ ReadTrackingState ( hasResolvedPositionInputControl , hasResolvedRotationInputControl ) ;
485487
486488 m_IsFirstUpdate = false ;
487489 }
@@ -492,7 +494,7 @@ protected void UpdateCallback()
492494 OnUpdate ( ) ;
493495 }
494496
495- void ReadTrackingState ( )
497+ void ReadTrackingState ( bool hasResolvedPositionInputControl , bool hasResolvedRotationInputControl )
496498 {
497499 var trackingStateAction = m_TrackingStateInput . action ;
498500 if ( trackingStateAction != null && ! trackingStateAction . enabled )
@@ -506,15 +508,12 @@ void ReadTrackingState()
506508 {
507509 // Treat an Input Action Reference with no reference the same as
508510 // an enabled Input Action with no authored bindings, and allow driving the Transform pose.
509- var hasPositionInputActionWithBindings = HasResolvedControl ( positionInput . action ) ;
510- var hasRotationInputActionWithBindings = HasResolvedControl ( rotationInput . action ) ;
511-
512511 // Check if we have transform and rotation controls to drive the pose.
513- if ( hasPositionInputActionWithBindings && hasRotationInputActionWithBindings )
512+ if ( hasResolvedPositionInputControl && hasResolvedRotationInputControl )
514513 m_CurrentTrackingState = TrackingStates . Position | TrackingStates . Rotation ;
515- else if ( hasPositionInputActionWithBindings )
514+ else if ( hasResolvedPositionInputControl )
516515 m_CurrentTrackingState = TrackingStates . Position ;
517- else if ( hasRotationInputActionWithBindings )
516+ else if ( hasResolvedRotationInputControl )
518517 m_CurrentTrackingState = TrackingStates . Rotation ;
519518 else
520519 m_CurrentTrackingState = TrackingStates . None ;
@@ -629,8 +628,10 @@ private static bool HasResolvedControl(InputAction action)
629628 ref var bindingState = ref state . bindingStates [ i ] ;
630629 if ( bindingState . actionIndex != actionIndex )
631630 continue ;
631+
632632 if ( bindingState . isComposite )
633633 continue ;
634+
634635 if ( bindingState . controlCount > 0 )
635636 return true ;
636637 }
0 commit comments