Search Unity

Resolved XR Ray Interactor triggers 'Hover' on masked out objects

Discussion in 'XR Interaction Toolkit and Input' started by Simianosaurus, Feb 8, 2021.

  1. Simianosaurus

    Simianosaurus

    Joined:
    Feb 14, 2013
    Posts:
    14
    I'm using Unity 2020.2.2f1 and XR Interaction Toolkit 1.0.0-pre.2

    I've just started looking at the toolkit, so may be doing something wrong or found an issue, but I have an issue where the XR Ray Interactor seems to be triggering the 'Hover' event on objects that are behind other objects, even though the ray visually stops.

    My set up is:

    * A XR Ray Interactor
    ** Interaction Layer Mask set to a 'TestRay' layer
    ** Raycast Mask set to 'Everything'
    (I believed that this meant that the ray cast would be blocked by everything, and would only allow interactions with things that also had their Interaction Layer Mask set to the 'TestRay')

    * Two objects with the XR Grab Interactable component
    ** Interaction Layer Mask also set to the 'TestRay' layer
    ** One object is place behind and slightly offset to the other.

    When I rotate the ray so it comes into hits the front object, the ray visibly stops rendering there and the object receives the 'Hover' event.
    If I continue to rotate, until the ray would have hit the second object (if the first wasn't blocking it), I 'still' get a 'Hover' event on triggered on that object.

    This feels wrong. Shouldn't the 'Raycast Mask' be stopping the ray and not just the visuals for it?

    To test this further I added a colour change scripts to the objects and triggered that upon their XR Grab Interactable component's 'Hover Entered / Exited' Interactable Events and recorded a video... but I couldn't upload that, so I compiled a few thumbnails of it together.
    Hopefully that shows my issue well enough.

    Cheers.
     

    Attached Files:

    Last edited: Feb 8, 2021
  2. Simianosaurus

    Simianosaurus

    Joined:
    Feb 14, 2013
    Posts:
    14
    There has been the answer and resolution below given elsewhere.