Skip to content

GazeProvider.GazeTarget getting set by other pointers #11145

@keith-phillips

Description

@keith-phillips

Describe the bug

This may be the same issue as observed in #9136.

The GazeProvider.GazeTarget value is getting overwritten by the focus target of other pointers. In my case the value was getting set by the hand-free GGV pointer in Editor. Depending on the order of registration of pointers, I believe you could end up with any other pointer overwriting the GazeTarget.

To reproduce

  • Have the input simulation system configured with 'Is Hands Free Input Enabled' and 'Default Eye Gaze Simulation Mode' = 'Mouse'.
  • Configure the raycast layers for the gaze pointer and the GGV pointer to be mutually exclusive
  • Create a scene with 2 colliders, the first 'C1' (gaze-hittable) occluding the second 'C2' (GGV hittable)
  • Start and point the mouse cursor through 'C1' at 'C2'
  • The GazeTarget will be set to 'C2', which the gaze pointer should not be able to hit

Expected behavior

The GazeTarget should only be updated by the gaze pointer

Your setup (please complete the following information)

  • Unity Version 2019.4
  • MRTK Version 2.8.1

Target platform (please complete the following information)

  • HoloLens 2

Additional context

After digging into it for a bit, the FocusProvider sets the GazeProvider.GazeTarget from the internal member 'gazeHitResult'. This member is a reference to one of 2 other internal members ('hitResult3d' or 'hitResultUi'), but these members are re-used for raycasts on other pointers later in the frame.

If another pointer is processed after the gaze pointer, it may overwrite the contents of the 'gazHitResult' object resulting in the wrong GazeTarget being set.

I'll submit a PR with a possible fix for this shortly

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions