@@ -255,6 +255,12 @@ public void Set(MixedRealityRaycastHit hit, RayStep ray, int rayStepIndex, float
255255 public void Set ( RaycastResult result , Vector3 hitPointOnObject , Vector4 hitNormalOnObject , RayStep ray , int rayStepIndex , float rayDistance )
256256 {
257257 raycastHit = default ( MixedRealityRaycastHit ) ;
258+ raycastHit . point = hitPointOnObject ;
259+ raycastHit . normal = hitNormalOnObject ;
260+ raycastHit . distance = rayDistance ;
261+ raycastHit . transform = result . gameObject . transform ;
262+ raycastHit . raycastValid = false ;
263+
258264 graphicsRaycastResult = result ;
259265
260266 this . hitObject = result . gameObject ;
@@ -264,6 +270,7 @@ public void Set(RaycastResult result, Vector3 hitPointOnObject, Vector4 hitNorma
264270 this . ray = ray ;
265271 this . rayStepIndex = rayStepIndex ;
266272 this . rayDistance = rayDistance ;
273+
267274 }
268275 }
269276
@@ -557,10 +564,17 @@ private void UpdateGazeProvider()
557564 LayerMask [ ] prioritizedLayerMasks = ( gazeProviderPointingData . Pointer . PrioritizedLayerMasksOverride ?? FocusLayerMasks ) ;
558565 QueryScene ( gazeProviderPointingData . Pointer , raycastProvider , prioritizedLayerMasks ,
559566 hitResult3d , maxQuerySceneResults , focusIndividualCompoundCollider ) ;
560- gazeHitResult = hitResult3d ;
567+ //gazeHitResult = hitResult3d;
568+
569+ hitResultUi . Clear ( ) ;
570+ RaycastGraphics ( gazeProviderPointingData . Pointer , gazeProviderPointingData . GraphicEventData , prioritizedLayerMasks , hitResultUi ) ;
571+
572+ gazeHitResult = GetPrioritizedHitResult ( hitResult3d , hitResultUi , prioritizedLayerMasks ) ;
573+ TruncatePointerRayToHit ( gazeProviderPointingData . Pointer , gazeHitResult ) ;
561574 }
562575
563576 CoreServices . InputSystem . GazeProvider . UpdateGazeInfoFromHit ( gazeHitResult . raycastHit ) ;
577+ Debug . LogWarning ( ( gazeHitResult . raycastHit . transform != null ) ? gazeHitResult . raycastHit . transform . name : "nothing" ) ;
564578
565579 // Zero out value after every use to ensure the hit result is updated every frame.
566580 gazeHitResult = null ;
@@ -957,11 +971,6 @@ private void UpdatePointer(PointerData pointerData)
957971 hitResult3d . Clear ( ) ;
958972 QueryScene ( pointerData . Pointer , raycastProvider , prioritizedLayerMasks , hitResult3d , maxQuerySceneResults , focusIndividualCompoundCollider ) ;
959973
960- if ( pointerData . Pointer . PointerId == gazeProviderPointingData . Pointer . PointerId )
961- {
962- gazeHitResult = hitResult3d ;
963- }
964-
965974 int hitResult3dLayer = hitResult3d . hitObject != null ? hitResult3d . hitObject . layer : - 1 ;
966975 if ( hitResult3dLayer == 0 )
967976 {
@@ -982,6 +991,8 @@ private void UpdatePointer(PointerData pointerData)
982991 hit = GetPrioritizedHitResult ( hit , hitResultUi , prioritizedLayerMasks ) ;
983992 }
984993
994+
995+
985996 if ( hit != hitResult3d || hitResult3dLayer > 0 )
986997 {
987998 // Truncate if we didn't already for this hit
@@ -997,6 +1008,12 @@ private void UpdatePointer(PointerData pointerData)
9971008 // Apply the hit result only now so changes in the current target are detected only once per frame.
9981009 pointerData . UpdateHit ( hit ) ;
9991010
1011+ // set gaze hit result - make sure to include unity ui hits
1012+ if ( pointerData . Pointer . PointerId == gazeProviderPointingData . Pointer . PointerId )
1013+ {
1014+ gazeHitResult = hit ;
1015+ }
1016+
10001017 // Set the pointer's result last
10011018 pointerData . Pointer . Result = pointerData ;
10021019 }
0 commit comments