Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug XR Ray Interactor shortened by XR UI Canvass (effecting teleportation)

Discussion in 'XR Interaction Toolkit and Input' started by ZooLoose, May 1, 2023.

  1. ZooLoose

    ZooLoose

    Joined:
    Jan 10, 2022
    Posts:
    3
    I'm using the XR Ray for teleportation and in the same scene trying to also interact with a button on the XR UI canvass. Both work as they should on their own but after the ray comes into contact with the UI it is shortened to the distance I am from the UI. Meaning if I try to teleport after coming into contact with it the ray is too short to even reach the ground. I'm using 2.3.1


    I have tried using some older versions as well. I either get the same problem or instead the ray will snap and stick to the UI
     
  2. ericprovencher

    ericprovencher

    Unity Technologies

    Joined:
    Dec 17, 2020
    Posts:
    156
    Thanks for flagging this. From what I know of the code, it is unfortunately by design that a ray interactor (which the teleport interactor is) is blocked by UGUI by default. Having it not do that may require a version bump. Alternatively you can play with interaction layers to make your UI on a layer only the main ray interactor can use.

    Edit: I just realized there's an option on the ray interactor for the teleport "Enable Interaction with UI GameObjects" that you can disable to resovle this issue. Hope that helps.
     
    ZooLoose likes this.
  3. ZooLoose

    ZooLoose

    Joined:
    Jan 10, 2022
    Posts:
    3
    By a version bump do you mean an update on Unity's end?

    I need the ray to interact with both the UI and teleport so disabling that isn't an option unfortunately but thanks.

    I'll update here if I find a solution!
     
  4. ericprovencher

    ericprovencher

    Unity Technologies

    Joined:
    Dec 17, 2020
    Posts:
    156
    Did you see my edit? You can disable the option only for the teleport ray interactor in your setup prefab and it’ll still work with the normal ray interactor.
     
  5. ZooLoose

    ZooLoose

    Joined:
    Jan 10, 2022
    Posts:
    3
    I did.. I don't have a teleportation ray interactor component specifically just the xr ray interactor component as you see in the picture. If I uncheck it on that component it stops working with the UI.

    I did find a way around it just using 2 xr rays on the same hand. one for teleportation and one for ui. Not quite what I was going for but it works.
     

    Attached Files:

  6. ericprovencher

    ericprovencher

    Unity Technologies

    Joined:
    Dec 17, 2020
    Posts:
    156
    Oh I misunderstood how you were using this. Yeah the recommended practice is two interactors, for for interacting with ui and objects, and one for teleporting.
    I recommend looking at our starter asset prefab to understand the proper setup.
     
    ZooLoose likes this.