Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Select interactable object with trigger and ray

Discussion in 'XR Interaction Toolkit and Input' started by avivXR, May 9, 2022.

  1. avivXR

    avivXR

    Joined:
    Nov 4, 2015
    Posts:
    14
    How can I select an object with the ray and a trigger without the grip button?
     
  2. VRDave_Unity

    VRDave_Unity

    Unity Technologies

    Joined:
    Nov 19, 2021
    Posts:
    260
    Hey @V1V0,
    The easiest way to do this is to add an additional Action called
    Far Select
    that is a duplicate of what we have as the Activate action (uses the trigger). Then you can add another
    XR Controller (Action-based)
    on the
    Ray Interactor
    and set the Select Action to the
    Far Select
    action you created.

    upload_2022-5-10_14-19-20.png

    You could go one step further and extend the Ray Interactor to swap the Select Action on Hover based on the distance to the object. This is something we have talked a lot about internally. We are also looking for the best method to deal with style of near/far interactions.
     
  3. avivXR

    avivXR

    Joined:
    Nov 4, 2015
    Posts:
    14
    Wow.. Haven't thought about that. I started to develop a new raycast module.
    Your solution sounds so much better. I will give it a shot. Thanks!
     
  4. avivXR

    avivXR

    Joined:
    Nov 4, 2015
    Posts:
    14
    It works. Awesome.
    Yet now I need to detect ahead which controller to activate, therefore I think I will need a raycast to tell me if the object is "grabable" where you need the grip to select or is it "selectable" where you need only the trigger to select.