@@ -657,6 +657,12 @@ private void UpdateSourceData(InteractionSourceState interactionSourceState, Sou
657657 // Using a heuristic for IsSupported, since the APIs don't yet support querying this capability directly.
658658 sourceData . GripPosition . IsSupported |= sourceData . GripPosition . IsAvailable ;
659659
660+ if ( Camera . main . transform . parent != null )
661+ {
662+ newPointerPosition = Camera . main . transform . parent . TransformPoint ( newPointerPosition ) ;
663+ newGripPosition = Camera . main . transform . parent . TransformPoint ( newGripPosition ) ;
664+ }
665+
660666 if ( sourceData . PointerPosition . IsAvailable || sourceData . GripPosition . IsAvailable )
661667 {
662668 sourceData . PositionUpdated = ! ( sourceData . PointerPosition . CurrentReading . Equals ( newPointerPosition ) && sourceData . GripPosition . CurrentReading . Equals ( newGripPosition ) ) ;
@@ -673,6 +679,13 @@ private void UpdateSourceData(InteractionSourceState interactionSourceState, Sou
673679 sourceData . GripRotation . IsAvailable = interactionSourceState . sourcePose . TryGetRotation ( out newGripRotation , InteractionSourceNode . Grip ) ;
674680 // Using a heuristic for IsSupported, since the APIs don't yet support querying this capability directly.
675681 sourceData . GripRotation . IsSupported |= sourceData . GripRotation . IsAvailable ;
682+
683+ if ( Camera . main . transform . parent != null )
684+ {
685+ newPointerRotation . eulerAngles = Camera . main . transform . parent . TransformDirection ( newPointerRotation . eulerAngles ) ;
686+ newGripRotation . eulerAngles = Camera . main . transform . parent . TransformDirection ( newGripRotation . eulerAngles ) ;
687+ }
688+
676689 if ( sourceData . PointerRotation . IsAvailable || sourceData . GripRotation . IsAvailable )
677690 {
678691 sourceData . RotationUpdated = ! ( sourceData . PointerRotation . CurrentReading . Equals ( newPointerRotation ) && sourceData . GripRotation . CurrentReading . Equals ( newGripRotation ) ) ;
@@ -683,6 +696,12 @@ private void UpdateSourceData(InteractionSourceState interactionSourceState, Sou
683696 Vector3 pointerForward = Vector3 . zero ;
684697 sourceData . PointingRay . IsSupported = interactionSourceState . source . supportsPointing ;
685698 sourceData . PointingRay . IsAvailable = sourceData . PointerPosition . IsAvailable && interactionSourceState . sourcePose . TryGetForward ( out pointerForward , InteractionSourceNode . Pointer ) ;
699+
700+ if ( Camera . main . transform . parent != null )
701+ {
702+ pointerForward = Camera . main . transform . parent . TransformDirection ( pointerForward ) ;
703+ }
704+
686705 sourceData . PointingRay . CurrentReading = new Ray ( sourceData . PointerPosition . CurrentReading , pointerForward ) ;
687706
688707 sourceData . Thumbstick . IsSupported = interactionSourceState . source . supportsThumbstick ;
0 commit comments