Search Unity

[XR Interaction Toolkit] GUI not blocking AR Placement Raycasts

Discussion in 'XR Interaction Toolkit and Input' started by d4n3x, Jan 21, 2020.

Thread Status:
Not open for further replies.
  1. d4n3x

    d4n3x

    Joined:
    Jan 23, 2019
    Posts:
    24
    As mentioned in the Headline it is currently not working for me to Block the PlacementRaycasts with a GUI-Overlay. If a Plane is already detected none of the GUI-Elements(Buttons, Panels,etc.) are Blocking the Placement Raycast. So if for example a button is pressed, maybe an object is also placed.

    Can somebody copy that? Or does someone already have a fix/WA for that?

    Greets
     
  2. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,452
    A fix is coming in the next release, for now:


    If you'd like to fix it locally in your package code, it's in XRRayInteractor.cs: Line 319
    Change
    if (raycastPointIndex < positionInLine || ((raycastPointIndex == rayIndex) && (raycastHit.distance <= distance)))

    To
    if (raycastPointIndex < rayIndex || ((raycastPointIndex == rayIndex) && (result.distance <= distance)))
     
    d4n3x likes this.
  3. d4n3x

    d4n3x

    Joined:
    Jan 23, 2019
    Posts:
    24
    Thank you, I will try that out ;-)
     
  4. d4n3x

    d4n3x

    Joined:
    Jan 23, 2019
    Posts:
    24
    Oh I forgot to mention that this is an AR problem on my Side. So no XRRayInteractor in use. Edited the title...
     
    ROBYER1 likes this.
  5. d4n3x

    d4n3x

    Joined:
    Jan 23, 2019
    Posts:
    24

    So sadly thats not working...
     
  6. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,452
    Oh apologies, I can see why now perhaps, worth reporting with the Unity Bug reporter
     
  7. d4n3x

    d4n3x

    Joined:
    Jan 23, 2019
    Posts:
    24
    Is there any Change to Catch that Rays when there is a Gameobject(GUI) over them @ROBYER1 ?
     
  8. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,452
    The latest release of XR Interaction Toolkit fixes it
     
    Matt_D_work likes this.
  9. d4n3x

    d4n3x

    Joined:
    Jan 23, 2019
    Posts:
    24
    does it? Had some Troubles updating to it because it shot my omnisharp. Will try that out in a minute :)
     
  10. d4n3x

    d4n3x

    Joined:
    Jan 23, 2019
    Posts:
    24
    I'm not quite sure what u ment but I am still able to "click trough the GUI and place an AR Object" :-(
     
  11. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,452
    Check the layers on your raycaster, ensure the layer that your UI uses is a mask or layer in there, try adding and removing it as a layer to see if that makes any difference.
     
  12. d4n3x

    d4n3x

    Joined:
    Jan 23, 2019
    Posts:
    24
    We are talking from the GraphicRaycaster attached to my GUI right? Because in the AR Scene - I do not have a Raycaster - Only the ARPlacementInteractable Script. And there I try to set the InteractionLayers and Excluded UI (because UI has Layer UI).... So are we talking of the same Setup?
     
  13. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,452
    I'm using the VR Raycasters, however in the documentation and setup they are rather similar. All I can suggest is to try excluding and not excluding the layer your UI is using on that script for object placement. Also ensure that any image or button component in your UI blocking the raycast has Raycast Target ticked.

    If you are still having problems please report it using Unity Bug Reporter https://unity3d.com/unity/qa/bug-reporting
     
  14. d4n3x

    d4n3x

    Joined:
    Jan 23, 2019
    Posts:
    24

    I already checked that but it really seems to be a Bug of the Toolkit. I tried catching the Click-Events over a `CustomStandaloneInputModule` and therefore again edit the package local, however i cant find the right point to Call the EventSystems.EventSystem.current.IsPointerOverGameObject() since the behaviour is always off by 1. If i click 10 times on the UI - at the first click an object is placed the other 9 clicks not. If i clicked on the UI before and then click on the target plane 10 times the first hit does nothing and the other 9 placing objects. I tried to catch the Event in TapGesture.cs...
     
  15. d4n3x

    d4n3x

    Joined:
    Jan 23, 2019
    Posts:
    24
Thread Status:
Not open for further replies.